1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-22 22:13:35 +02:00

Merge pull request #5054 from godric3/map-editor-fix-editing-hero-primary-skills

Editing hero primary skill in map editor should not be influenced by artifacts
This commit is contained in:
Ivan Savenko 2024-12-10 13:09:48 +02:00 committed by GitHub
commit ee44c5d13f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
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;