mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-23 22:37:55 +02:00
Do not show bonuses for which unit only has percentage bonuses
This commit is contained in:
@@ -900,9 +900,12 @@ void CStackWindow::initBonusesList()
|
|||||||
BonusList groupIndepMin = group;
|
BonusList groupIndepMin = group;
|
||||||
BonusList groupIndepMax = group;
|
BonusList groupIndepMax = group;
|
||||||
BonusList groupNoMinMax = group;
|
BonusList groupNoMinMax = group;
|
||||||
|
BonusList groupBaseOnly = group;
|
||||||
|
|
||||||
groupIndepMin.remove_if([](const Bonus * b) { return b->valType != BonusValueType::INDEPENDENT_MIN; });
|
groupIndepMin.remove_if([](const Bonus * b) { return b->valType != BonusValueType::INDEPENDENT_MIN; });
|
||||||
groupIndepMax.remove_if([](const Bonus * b) { return b->valType != BonusValueType::INDEPENDENT_MAX; });
|
groupIndepMax.remove_if([](const Bonus * b) { return b->valType != BonusValueType::INDEPENDENT_MAX; });
|
||||||
groupNoMinMax.remove_if([](const Bonus * b) { return b->valType == BonusValueType::INDEPENDENT_MAX || b->valType == BonusValueType::INDEPENDENT_MIN; });
|
groupNoMinMax.remove_if([](const Bonus * b) { return b->valType == BonusValueType::INDEPENDENT_MAX || b->valType == BonusValueType::INDEPENDENT_MIN; });
|
||||||
|
groupBaseOnly.remove_if([](const Bonus * b) { return b->valType != BonusValueType::ADDITIVE_VALUE || b->valType == BonusValueType::BASE_NUMBER; });
|
||||||
|
|
||||||
int valIndepMin = groupIndepMin.totalValue();
|
int valIndepMin = groupIndepMin.totalValue();
|
||||||
int valIndepMax = groupIndepMax.totalValue();
|
int valIndepMax = groupIndepMax.totalValue();
|
||||||
@@ -914,8 +917,8 @@ void CStackWindow::initBonusesList()
|
|||||||
usedGroup = groupIndepMin; // bonus value was limited due to INDEPENDENT_MIN bonus -> show this bonus
|
usedGroup = groupIndepMin; // bonus value was limited due to INDEPENDENT_MIN bonus -> show this bonus
|
||||||
else if (!groupIndepMax.empty() && valNoMinMax != valIndepMax)
|
else if (!groupIndepMax.empty() && valNoMinMax != valIndepMax)
|
||||||
usedGroup = groupIndepMax; // bonus value was limited due to INDEPENDENT_MAX bonus -> show this bonus
|
usedGroup = groupIndepMax; // bonus value was limited due to INDEPENDENT_MAX bonus -> show this bonus
|
||||||
else
|
else if (!groupBaseOnly.empty())
|
||||||
usedGroup = groupNoMinMax; // bonus value is not limited - show first non-independent bonus
|
usedGroup = groupNoMinMax; // bonus value is not limited and has bonuses other than percent to base / percent to all - show first non-independent bonus
|
||||||
|
|
||||||
// It is possible that empty group was selected. For example, there is only INDEPENDENT effect with value of 0, which does not actually has any effect on this unit
|
// It is possible that empty group was selected. For example, there is only INDEPENDENT effect with value of 0, which does not actually has any effect on this unit
|
||||||
// For example, orb of vulnerability on unit without any resistances
|
// For example, orb of vulnerability on unit without any resistances
|
||||||
|
|||||||
Reference in New Issue
Block a user