From 8a481dc9bd07b926beab1b88e7cad02d36e6a916 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Thu, 4 Mar 2021 13:54:52 -0500 Subject: [PATCH] Core/Auras: implemented SPELL_AURA_MOD_HEALING_DONE_PCT_VERSUS_TARGET_HEALTH Port From (https://github.com/TrinityCore/TrinityCore/commit/ee2ebfe87db6e43fc0ee2e27d760d656eadf9526) --- Source/Framework/Constants/Spells/SpellAuraConst.cs | 2 +- Source/Game/Entities/Unit/Unit.Spells.cs | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Source/Framework/Constants/Spells/SpellAuraConst.cs b/Source/Framework/Constants/Spells/SpellAuraConst.cs index 6928a0424..83c4fca50 100644 --- a/Source/Framework/Constants/Spells/SpellAuraConst.cs +++ b/Source/Framework/Constants/Spells/SpellAuraConst.cs @@ -375,7 +375,7 @@ namespace Framework.Constants ModCurrencyCategoryGainPct = 351, //NYI Unk352 = 352, ModCamouflage = 353, // Nyi - ModHealingDonePctVersusTargetHealth = 354, // NYI Restoration Shaman Mastery - Mod Healing Based On Target'S Health (Less = More Healing) + ModHealingDonePctVersusTargetHealth = 354, // Restoration Shaman Mastery - Mod Healing Based On Target'S Health (Less = More Healing) ModCastingSpeed = 355, // NYI ProvideTotemCategory = 356, EnableBoss1UnitFrame = 357, diff --git a/Source/Game/Entities/Unit/Unit.Spells.cs b/Source/Game/Entities/Unit/Unit.Spells.cs index d155a64c6..8155e9fb6 100644 --- a/Source/Game/Entities/Unit/Unit.Spells.cs +++ b/Source/Game/Entities/Unit/Unit.Spells.cs @@ -533,6 +533,12 @@ namespace Game.Entities // Healing done percent DoneTotalMod *= GetTotalAuraMultiplier(AuraType.ModHealingDonePercent); + // bonus from missing health of target + float healthPctDiff = 100.0f - victim.GetHealthPct(); + foreach (AuraEffect healingDonePctVsTargetHealth in GetAuraEffectsByType(AuraType.ModHealingDonePctVersusTargetHealth)) + if (healingDonePctVsTargetHealth.IsAffectingSpell(spellProto)) + MathFunctions.AddPct(ref DoneTotalMod, MathFunctions.CalculatePct((float)healingDonePctVsTargetHealth.GetAmount(), healthPctDiff)); + return DoneTotalMod; }