mirror of
https://github.com/vcmi/vcmi.git
synced 2025-06-21 00:19:29 +02:00
Converted several namespace enums to enum class
This commit is contained in:
@ -54,7 +54,7 @@ int AFactionMember::getAttack(bool ranged) const
|
||||
{
|
||||
const std::string cachingStr = "type_PRIMARY_SKILLs_ATTACK";
|
||||
|
||||
static const auto selector = Selector::typeSubtype(BonusType::PRIMARY_SKILL, PrimarySkill::ATTACK);
|
||||
static const auto selector = Selector::typeSubtype(BonusType::PRIMARY_SKILL, static_cast<int>(PrimarySkill::ATTACK));
|
||||
|
||||
return getBonusBearer()->valOfBonuses(selector, cachingStr);
|
||||
}
|
||||
@ -63,7 +63,7 @@ int AFactionMember::getDefense(bool ranged) const
|
||||
{
|
||||
const std::string cachingStr = "type_PRIMARY_SKILLs_DEFENSE";
|
||||
|
||||
static const auto selector = Selector::typeSubtype(BonusType::PRIMARY_SKILL, PrimarySkill::DEFENSE);
|
||||
static const auto selector = Selector::typeSubtype(BonusType::PRIMARY_SKILL, static_cast<int>(PrimarySkill::DEFENSE));
|
||||
|
||||
return getBonusBearer()->valOfBonuses(selector, cachingStr);
|
||||
}
|
||||
@ -82,12 +82,12 @@ int AFactionMember::getMaxDamage(bool ranged) const
|
||||
return getBonusBearer()->valOfBonuses(selector, cachingStr);
|
||||
}
|
||||
|
||||
int AFactionMember::getPrimSkillLevel(PrimarySkill::PrimarySkill id) const
|
||||
int AFactionMember::getPrimSkillLevel(PrimarySkill id) const
|
||||
{
|
||||
static const CSelector selectorAllSkills = Selector::type()(BonusType::PRIMARY_SKILL);
|
||||
static const std::string keyAllSkills = "type_PRIMARY_SKILL";
|
||||
auto allSkills = getBonusBearer()->getBonuses(selectorAllSkills, keyAllSkills);
|
||||
auto ret = allSkills->valOfBonuses(Selector::subtype()(id));
|
||||
auto ret = allSkills->valOfBonuses(Selector::subtype()(static_cast<int>(id)));
|
||||
auto minSkillValue = (id == PrimarySkill::SPELL_POWER || id == PrimarySkill::KNOWLEDGE) ? 1 : 0;
|
||||
return std::max(ret, minSkillValue); //otherwise, some artifacts may cause negative skill value effect, sp=0 works in old saves
|
||||
}
|
||||
@ -183,4 +183,4 @@ bool ACreature::isLiving() const //TODO: theoreticaly there exists "LIVING" bonu
|
||||
}
|
||||
|
||||
|
||||
VCMI_LIB_NAMESPACE_END
|
||||
VCMI_LIB_NAMESPACE_END
|
||||
|
Reference in New Issue
Block a user