1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-20 20:23:03 +02:00

Editing hero primary skill in map editor should not be influenced by artifacts

This commit is contained in:
godric3 2024-12-08 17:49:41 +01:00
parent 543ce94132
commit 31e4937a8c
2 changed files with 6 additions and 5 deletions

View File

@ -1923,7 +1923,8 @@ int CGHeroInstance::getBasePrimarySkillValue(PrimarySkill which) const
{
std::string cachingStr = "type_PRIMARY_SKILL_base_" + std::to_string(static_cast<int>(which));
auto selector = Selector::typeSubtype(BonusType::PRIMARY_SKILL, BonusSubtypeID(which)).And(Selector::sourceType()(BonusSource::HERO_BASE_SKILL));
return valOfBonuses(selector, cachingStr);
auto minSkillValue = VLC->engineSettings()->getVector(EGameSettings::HEROES_MINIMAL_PRIMARY_SKILLS)[which.getNum()];
return std::max(valOfBonuses(selector, cachingStr), minSkillValue);
}
VCMI_LIB_NAMESPACE_END

View File

@ -67,10 +67,10 @@ void HeroSkillsWidget::on_checkBox_toggled(bool checked)
void HeroSkillsWidget::obtainData()
{
ui->attack->setValue(hero.getPrimSkillLevel(PrimarySkill::ATTACK));
ui->defence->setValue(hero.getPrimSkillLevel(PrimarySkill::DEFENSE));
ui->power->setValue(hero.getPrimSkillLevel(PrimarySkill::SPELL_POWER));
ui->knowledge->setValue(hero.getPrimSkillLevel(PrimarySkill::KNOWLEDGE));
ui->attack->setValue(hero.getBasePrimarySkillValue(PrimarySkill::ATTACK));
ui->defence->setValue(hero.getBasePrimarySkillValue(PrimarySkill::DEFENSE));
ui->power->setValue(hero.getBasePrimarySkillValue(PrimarySkill::SPELL_POWER));
ui->knowledge->setValue(hero.getBasePrimarySkillValue(PrimarySkill::KNOWLEDGE));
if(!hero.secSkills.empty() && hero.secSkills.front().first.getNum() == -1)
return;