From 3de0fa37f827ad885b57d5a952139d895492d693 Mon Sep 17 00:00:00 2001 From: AlexVinS Date: Tue, 1 Aug 2017 16:59:45 +0300 Subject: [PATCH] Possible fix for https://bugs.vcmi.eu/view.php?id=2759 --- lib/spells/CSpellHandler.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/spells/CSpellHandler.cpp b/lib/spells/CSpellHandler.cpp index 056c4b4d5..f92620bce 100644 --- a/lib/spells/CSpellHandler.cpp +++ b/lib/spells/CSpellHandler.cpp @@ -418,16 +418,18 @@ int CSpell::adjustRawDamage(const ISpellCaster * caster, const CStack * affected { if(affectedCreature->hasBonusOfType(Bonus::SPELL_DAMAGE_REDUCTION, (ui8)cnf.id)) { - ret *= affectedCreature->valOfBonuses(Bonus::SPELL_DAMAGE_REDUCTION, (ui8)cnf.id); + ret *= 100 - affectedCreature->valOfBonuses(Bonus::SPELL_DAMAGE_REDUCTION, (ui8)cnf.id); ret /= 100; stop = true;//only bonus from one school is used } }); + CSelector selector = Selector::type(Bonus::SPELL_DAMAGE_REDUCTION).And(Selector::subtype(-1)); + //general spell dmg reduction - if(affectedCreature->hasBonusOfType(Bonus::SPELL_DAMAGE_REDUCTION, -1)) + if(affectedCreature->hasBonus(selector)) { - ret *= affectedCreature->valOfBonuses(Bonus::SPELL_DAMAGE_REDUCTION, -1); + ret *= 100 - affectedCreature->valOfBonuses(selector); ret /= 100; }