From 96260bf628336cc3bb928f131ec65846771e3adf Mon Sep 17 00:00:00 2001 From: Ovahlord Date: Sat, 26 May 2018 15:11:53 +0200 Subject: [PATCH] Core/Spells: updated Gift of the Naaru to Cataclysm --- src/server/scripts/Spells/spell_generic.cpp | 30 +++++---------------- 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 9a6699f599..21cf07cafc 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -1813,33 +1813,15 @@ class spell_gen_gift_of_naaru : public SpellScriptLoader void CalculateAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) { - if (!GetCaster()) + Unit* target = GetOwner()->ToUnit(); + if (!target) return; - float heal = 0.0f; - switch (GetSpellInfo()->SpellFamilyName) - { - case SPELLFAMILY_MAGE: - case SPELLFAMILY_WARLOCK: - case SPELLFAMILY_PRIEST: - heal = 1.885f * float(GetCaster()->SpellBaseDamageBonusDone(GetSpellInfo()->GetSchoolMask())); - break; - case SPELLFAMILY_PALADIN: - case SPELLFAMILY_SHAMAN: - heal = std::max(1.885f * float(GetCaster()->SpellBaseDamageBonusDone(GetSpellInfo()->GetSchoolMask())), 1.1f * float(GetCaster()->GetTotalAttackPowerValue(BASE_ATTACK))); - break; - case SPELLFAMILY_WARRIOR: - case SPELLFAMILY_HUNTER: - case SPELLFAMILY_DEATHKNIGHT: - heal = 1.1f * float(std::max(GetCaster()->GetTotalAttackPowerValue(BASE_ATTACK), GetCaster()->GetTotalAttackPowerValue(RANGED_ATTACK))); - break; - case SPELLFAMILY_GENERIC: - default: - break; - } + uint64 health = target->GetMaxHealth(); + int32 healthPct = CalculatePct(health, GetSpellInfo()->Effects[EFFECT_1].BasePoints); - int32 healTick = std::floor(heal / aurEff->GetTotalTicks()); - amount += int32(std::max(healTick, 0)); + if (healthPct) + amount = std::floor(healthPct / aurEff->GetTotalTicks()); } void Register() override