diff options
Diffstat (limited to 'src/game/Unit.cpp')
-rw-r--r-- | src/game/Unit.cpp | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 5a07c68efe4..8608daa55fc 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -12212,6 +12212,27 @@ Unit* Creature::SelectVictim() //====================================================================== //====================================================================== +int32 Unit::ApplyEffectModifiers(SpellEntry const* spellProto, uint8 effect_index, int32 value) +{ + if (Player* modOwner = GetSpellModOwner()) + { + modOwner->ApplySpellMod(spellProto->Id,SPELLMOD_ALL_EFFECTS, value); + switch (effect_index) + { + case 0: + modOwner->ApplySpellMod(spellProto->Id,SPELLMOD_EFFECT1, value); + break; + case 1: + modOwner->ApplySpellMod(spellProto->Id,SPELLMOD_EFFECT2, value); + break; + case 2: + modOwner->ApplySpellMod(spellProto->Id,SPELLMOD_EFFECT3, value); + break; + } + } + return value; +} + int32 Unit::CalculateSpellDamage(SpellEntry const* spellProto, uint8 effect_index, int32 effBasePoints, Unit const* /*target*/) { int32 level = int32(getLevel()); @@ -12239,22 +12260,7 @@ int32 Unit::CalculateSpellDamage(SpellEntry const* spellProto, uint8 effect_inde if (float comboDamage = spellProto->EffectPointsPerComboPoint[effect_index]) value += int32(comboDamage * comboPoints); - if (Player* modOwner = GetSpellModOwner()) - { - modOwner->ApplySpellMod(spellProto->Id,SPELLMOD_ALL_EFFECTS, value); - switch (effect_index) - { - case 0: - modOwner->ApplySpellMod(spellProto->Id,SPELLMOD_EFFECT1, value); - break; - case 1: - modOwner->ApplySpellMod(spellProto->Id,SPELLMOD_EFFECT2, value); - break; - case 2: - modOwner->ApplySpellMod(spellProto->Id,SPELLMOD_EFFECT3, value); - break; - } - } + value = ApplyEffectModifiers(spellProto, effect_index, value); if (!basePointsPerLevel && (spellProto->Attributes & SPELL_ATTR_LEVEL_DAMAGE_CALCULATION && spellProto->spellLevel) && spellProto->Effect[effect_index] != SPELL_EFFECT_WEAPON_PERCENT_DAMAGE && |