1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-15 01:24:45 +02:00

support 0 spellpower and knowledge

This commit is contained in:
kdmcser
2024-08-05 22:05:52 +08:00
parent b7391f49f6
commit 87eb026184
9 changed files with 68 additions and 5 deletions

View File

@ -13,6 +13,7 @@
#include "VCMI_Lib.h"
#include "GameConstants.h"
#include "GameSettings.h"
#include "MinimalPrimarySkill.h"
#include "bonuses/BonusList.h"
#include "bonuses/Bonus.h"
#include "bonuses/IBonusBearer.h"
@ -86,7 +87,7 @@ int AFactionMember::getPrimSkillLevel(PrimarySkill id) const
static const std::string keyAllSkills = "type_PRIMARY_SKILL";
auto allSkills = getBonusBearer()->getBonuses(selectorAllSkills, keyAllSkills);
auto ret = allSkills->valOfBonuses(Selector::subtype()(BonusSubtypeID(id)));
auto minSkillValue = (id == PrimarySkill::SPELL_POWER || id == PrimarySkill::KNOWLEDGE) ? 1 : 0;
auto minSkillValue = getPrimarySkillMinimum(id);
return std::max(ret, minSkillValue); //otherwise, some artifacts may cause negative skill value effect, sp=0 works in old saves
}