mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Fix leveling up secondary skills via Scholar (map object) visit
This commit is contained in:
parent
5bc103f50e
commit
77e827c51e
@ -106,12 +106,12 @@ void Rewardable::Interface::grantRewardBeforeLevelup(IGameCallback * cb, const R
|
||||
|
||||
for(const auto & entry : info.reward.secondary)
|
||||
{
|
||||
int current = hero->getSecSkillLevel(entry.first);
|
||||
if( (current != 0 && current < entry.second) ||
|
||||
(hero->canLearnSkill() ))
|
||||
{
|
||||
cb->changeSecSkill(hero, entry.first, entry.second);
|
||||
}
|
||||
auto currentLevel = static_cast<MasteryLevel::Type>(hero->getSecSkillLevel(entry.first));
|
||||
if(currentLevel == MasteryLevel::EXPERT)
|
||||
continue;
|
||||
|
||||
if(currentLevel != MasteryLevel::NONE || hero->canLearnSkill())
|
||||
cb->changeSecSkill(hero, entry.first, entry.second, false);
|
||||
}
|
||||
|
||||
for(int i=0; i< info.reward.primary.size(); i++)
|
||||
|
@ -103,7 +103,13 @@ void Rewardable::Reward::loadComponents(std::vector<Component> & comps, const CG
|
||||
}
|
||||
|
||||
for(const auto & entry : secondary)
|
||||
comps.emplace_back(ComponentType::SEC_SKILL, entry.first, entry.second);
|
||||
{
|
||||
auto skillID = entry.first;
|
||||
int levelsGained = entry.second;
|
||||
int currentLevel = h->getSecSkillLevel(skillID);
|
||||
int finalLevel = std::min(static_cast<int>(MasteryLevel::EXPERT), currentLevel + levelsGained);
|
||||
comps.emplace_back(ComponentType::SEC_SKILL, entry.first, finalLevel);
|
||||
}
|
||||
|
||||
for(const auto & entry : artifacts)
|
||||
comps.emplace_back(ComponentType::ARTIFACT, entry);
|
||||
|
Loading…
Reference in New Issue
Block a user