1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-27 22:49:25 +02:00

vcmi: use SpellSchool identifier instead of enum

Use identifier instead of enum inside callbacks. It is better and more
expandable solution.
This commit is contained in:
Konstantin
2023-08-21 22:10:32 +03:00
committed by Konstantin P
parent 75c39c6562
commit d746a96d55
10 changed files with 28 additions and 28 deletions

View File

@@ -620,14 +620,14 @@ int32_t CGHeroInstance::getSpellSchoolLevel(const spells::Spell * spell, int32_t
{
int32_t skill = -1; //skill level
spell->forEachSchool([&, this](const ESpellSchool & cnf, bool & stop)
spell->forEachSchool([&, this](const SpellSchool & cnf, bool & stop)
{
int32_t thisSchool = valOfBonuses(BonusType::MAGIC_SCHOOL_SKILL, SpellSchool(cnf)); //FIXME: Bonus shouldn't be additive (Witchking Artifacts : Crown of Skies)
int32_t thisSchool = valOfBonuses(BonusType::MAGIC_SCHOOL_SKILL, cnf); //FIXME: Bonus shouldn't be additive (Witchking Artifacts : Crown of Skies)
if(thisSchool > skill)
{
skill = thisSchool;
if(outSelectedSchool)
*outSelectedSchool = SpellSchool(cnf);
*outSelectedSchool = cnf;
}
});
@@ -650,9 +650,9 @@ int64_t CGHeroInstance::getSpellBonus(const spells::Spell * spell, int64_t base,
int maxSchoolBonus = 0;
spell->forEachSchool([&maxSchoolBonus, this](const ESpellSchool & cnf, bool & stop)
spell->forEachSchool([&maxSchoolBonus, this](const SpellSchool & cnf, bool & stop)
{
vstd::amax(maxSchoolBonus, valOfBonuses(BonusType::SPELL_DAMAGE, SpellSchool(cnf)));
vstd::amax(maxSchoolBonus, valOfBonuses(BonusType::SPELL_DAMAGE, cnf));
});
base = static_cast<int64_t>(base * (100 + maxSchoolBonus) / 100.0);
@@ -739,9 +739,9 @@ bool CGHeroInstance::canCastThisSpell(const spells::Spell * spell) const
bool schoolBonus = false;
spell->forEachSchool([this, &schoolBonus](const ESpellSchool & cnf, bool & stop)
spell->forEachSchool([this, &schoolBonus](const SpellSchool & cnf, bool & stop)
{
if(hasBonusOfType(BonusType::SPELLS_OF_SCHOOL, SpellSchool(cnf)))
if(hasBonusOfType(BonusType::SPELLS_OF_SCHOOL, cnf))
{
schoolBonus = stop = true;
}