1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-23 22:37:55 +02:00

Feature: Town Negative Bonuses. Fix: Negative bonus bearers should not be affected

This commit is contained in:
Dmitry Orlov
2021-02-03 20:19:56 +03:00
parent 3cb88b6964
commit 6f0864b47c
6 changed files with 86 additions and 40 deletions

View File

@@ -404,18 +404,22 @@ void MoraleLuckBox::set(const IBonusBearer * node)
text += "\n" + noLuck->Description();
bonusValue = 0;
}
else if(modifierList->empty())
text += CGI->generaltexth->arraytxt[noneTxtId];//no modifiers
else
{
for(auto& elem : *modifierList)
{
if(elem->val != 0)
//no bonuses with value 0
text += "\n" + elem->Description();
}
}
bool isListActual = false;
std::string addInfo = "";
for(auto & bonus : * modifierList)
{
if(bonus->val && bonus->effectRange != Bonus::ONLY_ENEMY_ARMY)
{
addInfo += "\n" + bonus->Description();
isListActual = true;
}
}
text = isListActual ? text + addInfo
: text + CGI->generaltexth->arraytxt[noneTxtId];//no modifiers
}
std::string imageName;
if (small)
imageName = morale ? "IMRL30": "ILCK30";