1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-03 00:46:55 +02:00

Initial version of new bonus caching system

This commit is contained in:
Ivan Savenko
2024-12-24 23:11:20 +00:00
parent 873d916a41
commit 16cfb51f3e
12 changed files with 286 additions and 332 deletions

View File

@ -69,14 +69,6 @@ int AFactionMember::getMaxDamage(bool ranged) const
return getBonusBearer()->valOfBonuses(selector, cachingStr);
}
int AFactionMember::getPrimSkillLevel(PrimarySkill id) const
{
auto allSkills = getBonusBearer()->getBonusesOfType(BonusType::PRIMARY_SKILL);
int ret = allSkills->valOfBonuses(Selector::subtype()(BonusSubtypeID(id)));
int minSkillValue = VLC->engineSettings()->getVectorValue(EGameSettings::HEROES_MINIMAL_PRIMARY_SKILLS, id.getNum());
return std::max(ret, minSkillValue); //otherwise, some artifacts may cause negative skill value effect, sp=0 works in old saves
}
int AFactionMember::moraleValAndBonusList(TConstBonusListPtr & bonusList) const
{
int32_t maxGoodMorale = VLC->engineSettings()->getVector(EGameSettings::COMBAT_GOOD_MORALE_DICE).size();