From a6c7f2b98c13a990c4c9bfd193cc6cb87cef01aa Mon Sep 17 00:00:00 2001 From: ariel- Date: Wed, 16 Nov 2016 04:06:32 -0300 Subject: [PATCH] Core/Spell: Fixed irregular handling of SPELLMOD_DOT --- src/server/game/Entities/Unit/Unit.cpp | 28 +++++++++++-------- .../game/Spells/Auras/SpellAuraEffects.cpp | 5 ++++ src/server/game/Spells/Auras/SpellAuras.cpp | 23 +++++++++------ src/server/game/Spells/SpellEffects.cpp | 9 ++++-- 4 files changed, 42 insertions(+), 23 deletions(-) diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index d27676c7be..5ba0e1306d 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -6692,14 +6692,16 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin DoneTotal += int32(DoneAdvertisedBenefit * coeff * factorMod); } + float tmpDamage = (int32(pdamage) + DoneTotal); + + // DOTs calculated in AuraEffect::PeriodicDamageAurasTick // Done Percentage for DOT is already calculated, no need to do it again. The percentage mod is applied in Aura::HandleAuraSpecificMods. - float tmpDamage = (int32(pdamage) + DoneTotal) * (damagetype == DOT ? 1.0f : SpellDamagePctDone(victim, spellProto, damagetype)); - // apply spellmod to Done damage (flat and pct) - if (Player* modOwner = GetSpellModOwner()) + if (damagetype != DOT) { - if (damagetype == DOT) - modOwner->ApplySpellMod(spellProto->Id, tmpDamage); - else + tmpDamage *= SpellDamagePctDone(victim, spellProto, damagetype); + + // apply spellmod to Done damage (flat and pct) + if (Player* modOwner = GetSpellModOwner()) modOwner->ApplySpellMod(spellProto->Id, tmpDamage); } @@ -7408,14 +7410,16 @@ uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, ui DoneTotal = 0; } + float heal = float(int32(healamount) + DoneTotal); + + // DOTs calculated in AuraEffect::HandlePeriodicHealAurasTick // Done Percentage for DOT is already calculated, no need to do it again. The percentage mod is applied in Aura::HandleAuraSpecificMods. - float heal = float(int32(healamount) + DoneTotal) * (damagetype == DOT ? 1.0f : SpellHealingPctDone(victim, spellProto)); - // apply spellmod to Done amount - if (Player* modOwner = GetSpellModOwner()) + if (damagetype != DOT) { - if (damagetype == DOT) - modOwner->ApplySpellMod(spellProto->Id, heal); - else + heal *= SpellHealingPctDone(victim, spellProto); + + // apply spellmod to Done amount + if (Player* modOwner = GetSpellModOwner()) modOwner->ApplySpellMod(spellProto->Id, heal); } diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 94c5823160..085f5bcece 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -5665,6 +5665,9 @@ void AuraEffect::HandlePeriodicHealthLeechAuraTick(Unit* target, Unit* caster) c else damage = std::max(int32(damage * GetDonePct()), 0); + if (Player* modOwner = caster->GetSpellModOwner()) + modOwner->ApplySpellMod(GetSpellInfo()->Id, damage); + damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount()); // Calculate armor mitigation @@ -5676,12 +5679,14 @@ void AuraEffect::HandlePeriodicHealthLeechAuraTick(Unit* target, Unit* caster) c } if (!m_spellInfo->HasAttribute(SPELL_ATTR4_FIXED_DAMAGE)) + { if (m_spellInfo->Effects[m_effIndex].IsTargetingArea() || isAreaAura) { damage = uint32(float(damage) * target->GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_AOE_DAMAGE_AVOIDANCE, m_spellInfo->SchoolMask)); if (caster->GetTypeId() != TYPEID_PLAYER) damage = uint32(float(damage) * target->GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_CREATURE_AOE_DAMAGE_AVOIDANCE, m_spellInfo->SchoolMask)); } + } bool crit = false; diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index 8b34ae2e52..58c76cf66e 100644 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.cpp @@ -1308,20 +1308,27 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b case SPELLFAMILY_PRIEST: if (!caster) break; + // Devouring Plague - if (GetSpellInfo()->SpellFamilyFlags[0] & 0x02000000 && GetEffect(0)) + if (GetSpellInfo()->SpellFamilyFlags[0] & 0x02000000) { + AuraEffect const* devouringPlague = GetEffect(EFFECT_0); + if (!devouringPlague) + break; + // Improved Devouring Plague if (AuraEffect const* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_PRIEST, 3790, 0)) { - uint32 damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), GetEffect(0)->GetAmount(), DOT); - damage *= caster->SpellDamagePctDone(target, GetSpellInfo(), SPELL_DIRECT_DAMAGE); - damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, DOT); - int32 basepoints0 = aurEff->GetAmount() * GetEffect(0)->GetTotalTicks() * int32(damage) / 100; - int32 heal = int32(CalculatePct(basepoints0, 15)); + int32 damage = (devouringPlague->GetAmount() + devouringPlague->GetBonusAmount()) * devouringPlague->GetDonePct(); + if (Player* modOwner = caster->GetSpellModOwner()) + modOwner->ApplySpellMod(GetSpellInfo()->Id, damage); - caster->CastCustomSpell(target, 63675, &basepoints0, NULL, NULL, true, NULL, GetEffect(0)); - caster->CastCustomSpell(caster, 75999, &heal, NULL, NULL, true, NULL, GetEffect(0)); + damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, DOT); + + int32 basepoints0 = CalculatePct(devouringPlague->GetTotalTicks() * static_cast(damage), aurEff->GetAmount()); + int32 heal = CalculatePct(basepoints0, 15); + caster->CastCustomSpell(63675, SPELLVALUE_BASE_POINT0, basepoints0, target, true, nullptr, devouringPlague); + caster->CastCustomSpell(75999, SPELLVALUE_BASE_POINT0, heal, (Unit*)nullptr, true, nullptr, devouringPlague); } } // Power Word: Shield diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 7797176808..6362bbc284 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -1242,9 +1242,12 @@ void Spell::EffectHeal(SpellEffIndex /*effIndex*/) return; } - int32 tickheal = targetAura->GetAmount(); - if (Unit* auraCaster = targetAura->GetCaster()) - tickheal = auraCaster->SpellHealingBonusDone(unitTarget, targetAura->GetSpellInfo(), tickheal, DOT); + int32 tickheal = (targetAura->GetAmount() + targetAura->GetBonusAmount()) * targetAura->GetDonePct(); + if (Player* modOwner = m_caster->GetSpellModOwner()) + modOwner->ApplySpellMod(targetAura->GetId(), tickheal); + + unitTarget->SpellHealingBonusTaken(m_caster, targetAura->GetSpellInfo(), tickheal, DOT); + //int32 tickheal = targetAura->GetSpellInfo()->EffectBasePoints[idx] + 1; //It is said that talent bonus should not be included