1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-08-10 22:31:40 +02:00

Fix incorrect icon on removal of skill

This commit is contained in:
Ivan Savenko
2025-05-16 17:43:27 +03:00
parent cb82c6a4f6
commit c7228b7e50
2 changed files with 2 additions and 1 deletions

View File

@@ -418,6 +418,7 @@ Keep in mind, that all randomization is performed on map load and on object rese
- If hero does not have selected skill and have free skill slots, he will receive skill at specified level - If hero does not have selected skill and have free skill slots, he will receive skill at specified level
- Possible values: 1 (basic), 2 (advanced), 3 (expert) - Possible values: 1 (basic), 2 (advanced), 3 (expert)
- Each secondary skill can be explicitly specified or randomly selected - Each secondary skill can be explicitly specified or randomly selected
- Negative values can be used to downgrade or remove secondary skills from hero
```json ```json
"secondary": [ "secondary": [

View File

@@ -107,7 +107,7 @@ void Rewardable::Reward::loadComponents(std::vector<Component> & comps, const CG
auto skillID = entry.first; auto skillID = entry.first;
int levelsGained = entry.second; int levelsGained = entry.second;
int currentLevel = h ? h->getSecSkillLevel(skillID) : 0; int currentLevel = h ? h->getSecSkillLevel(skillID) : 0;
int finalLevel = std::min(static_cast<int>(MasteryLevel::EXPERT), currentLevel + levelsGained); int finalLevel = std::clamp<int>(currentLevel + levelsGained, MasteryLevel::BASIC, MasteryLevel::EXPERT);
comps.emplace_back(ComponentType::SEC_SKILL, entry.first, finalLevel); comps.emplace_back(ComponentType::SEC_SKILL, entry.first, finalLevel);
} }