MantisBT - VCMI
View Issue Details
0002882VCMIMechanics - Otherpublic2018-02-20 10:532018-02-20 11:29
hkoehler 
AVS 
normalminorhave not tried
resolvedfixed 
0.99 
0.next 
0002882: School-specific spell damage bonuses don't work properly for multi-school spells
Looks like it only applies the bonus (if any) from the first school. So e.g. magic arrow would only benefit from air bonus (as air is the first school), all other bonuses (like FIRE_SPELL_DMG_PREMY) are irrelevant. I believe the maximal bonus should apply here.
int64_t CGHeroInstance::getSpellBonus(const spells::Spell * spell, int64_t base, const battle::Unit * affectedStack) const
{
    //applying sorcery secondary skill

    base *= (100.0 + valOfBonuses(Bonus::SECONDARY_SKILL_PREMY, SecondarySkill::SORCERY)) / 100.0;
    base *= (100.0 + valOfBonuses(Bonus::SPELL_DAMAGE) + valOfBonuses(Bonus::SPECIFIC_SPELL_DAMAGE, spell->getIndex())) / 100.0;

    spell->forEachSchool([&base, this](const spells::SchoolInfo & cnf, bool & stop)
    {
        base *= (100.0 + valOfBonuses(cnf.damagePremyBonus)) / 100.0;
        stop = true; //only bonus from one school is used
    });

    if(affectedStack && affectedStack->creatureLevel() > 0) //Hero specials like Solmyr, Deemer
        base *= (100. + ((valOfBonuses(Bonus::SPECIAL_SPELL_LEV, spell->getIndex()) * level) / affectedStack->creatureLevel())) / 100.0;

    return base;
}
No tags attached.
Issue History
2018-02-20 10:53hkoehlerNew Issue
2018-02-20 11:17AVSAssigned To => AVS
2018-02-20 11:17AVSStatusnew => assigned
2018-02-20 11:29AVSNote Added: 0007417
2018-02-20 11:29AVSStatusassigned => resolved
2018-02-20 11:29AVSFixed in Version => 0.next
2018-02-20 11:29AVSResolutionopen => fixed

Notes
(0007417)
AVS   
2018-02-20 11:29   
Fixed in develop