diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index 6ebba36745..1c8e2ab112 100644 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -1797,6 +1797,8 @@ class TC_GAME_API Player : public Unit, public GridObject void UpdateAttackPowerAndDamage(bool ranged = false) override; void ApplySpellPowerBonus(int32 amount, bool apply); void UpdateSpellDamageAndHealingBonus(); + void UpdateSpellHealingPercentDone(); + void UpdateSpellHealingPercentTaken(); void ApplyRatingMod(CombatRating cr, int32 value, bool apply); void UpdateRating(CombatRating cr); void UpdateAllRatings(); diff --git a/src/server/game/Entities/Unit/StatSystem.cpp b/src/server/game/Entities/Unit/StatSystem.cpp index d2be07bac4..5d2b7d2c88 100644 --- a/src/server/game/Entities/Unit/StatSystem.cpp +++ b/src/server/game/Entities/Unit/StatSystem.cpp @@ -183,6 +183,25 @@ void Player::UpdateSpellDamageAndHealingBonus() } } +void Player::UpdateSpellHealingPercentDone() +{ + SetFloatValue(PLAYER_FIELD_MOD_HEALING_DONE_PCT, GetTotalAuraMultiplier(SPELL_AURA_MOD_HEALING_DONE_PERCENT)); +} + +void Player::UpdateSpellHealingPercentTaken() +{ + float TakenTotalMod = 1.f; + float minval = float(GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HEALING_PCT)); + if (minval) + AddPct(TakenTotalMod, minval); + + float maxval = float(GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HEALING_PCT)); + if (maxval) + AddPct(TakenTotalMod, maxval); + + SetFloatValue(PLAYER_FIELD_MOD_HEALING_PCT, TakenTotalMod); +} + bool Player::UpdateAllStats() { for (int8 i = STAT_STRENGTH; i < MAX_STATS; ++i) diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index db98ae29d5..01548ce536 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -7343,7 +7343,10 @@ float Unit::SpellHealingPctDone(Unit* victim, SpellInfo const* spellProto) const float DoneTotalMod = 1.0f; // Healing done percent - DoneTotalMod *= GetTotalAuraMultiplier(SPELL_AURA_MOD_HEALING_DONE_PERCENT); + if (IsPlayer()) + DoneTotalMod *= GetFloatValue(PLAYER_FIELD_MOD_HEALING_DONE_PCT); + else + DoneTotalMod *= GetTotalAuraMultiplier(SPELL_AURA_MOD_HEALING_DONE_PERCENT); // done scripted mod (take it from owner) Unit const* owner = GetOwner() ? GetOwner() : this; @@ -7418,13 +7421,18 @@ uint32 Unit::SpellHealingBonusTaken(Unit* caster, SpellInfo const* spellProto, u float TakenTotalMod = 1.0f; // Healing taken percent - float minval = float(GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HEALING_PCT)); - if (minval) - AddPct(TakenTotalMod, minval); + if (IsPlayer()) + TakenTotalMod *= GetFloatValue(PLAYER_FIELD_MOD_HEALING_PCT); + else + { + float minval = float(GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HEALING_PCT)); + if (minval) + AddPct(TakenTotalMod, minval); - float maxval = float(GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HEALING_PCT)); - if (maxval) - AddPct(TakenTotalMod, maxval); + float maxval = float(GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HEALING_PCT)); + if (maxval) + AddPct(TakenTotalMod, maxval); + } // Tenacity increase healing % taken if (AuraEffect const* Tenacity = GetAuraEffect(58549, 0)) diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index d976c96a81..eb8b363785 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -183,7 +183,7 @@ pAuraEffectHandler AuraEffectHandler[TOTAL_AURAS]= &AuraEffect::HandleNoImmediateEffect, //115 SPELL_AURA_MOD_HEALING implemented in Unit::SpellBaseHealingBonusForVictim &AuraEffect::HandleNoImmediateEffect, //116 SPELL_AURA_MOD_REGEN_DURING_COMBAT &AuraEffect::HandleNoImmediateEffect, //117 SPELL_AURA_MOD_MECHANIC_RESISTANCE implemented in Unit::MagicSpellHitResult - &AuraEffect::HandleNoImmediateEffect, //118 SPELL_AURA_MOD_HEALING_PCT implemented in Unit::SpellHealingBonus + &AuraEffect::HandleModHealingPercent, //118 SPELL_AURA_MOD_HEALING_PCT &AuraEffect::HandleUnused, //119 unused (4.3.4) old SPELL_AURA_SHARE_PET_TRACKING &AuraEffect::HandleAuraUntrackable, //120 SPELL_AURA_UNTRACKABLE &AuraEffect::HandleAuraEmpathy, //121 SPELL_AURA_EMPATHY @@ -201,7 +201,7 @@ pAuraEffectHandler AuraEffectHandler[TOTAL_AURAS]= &AuraEffect::HandleAuraModIncreaseHealthPercent, //133 SPELL_AURA_MOD_INCREASE_HEALTH_PERCENT &AuraEffect::HandleAuraModRegenInterrupt, //134 SPELL_AURA_MOD_MANA_REGEN_INTERRUPT &AuraEffect::HandleModHealingDone, //135 SPELL_AURA_MOD_HEALING_DONE - &AuraEffect::HandleNoImmediateEffect, //136 SPELL_AURA_MOD_HEALING_DONE_PERCENT implemented in Unit::SpellHealingBonus + &AuraEffect::HandleModHealingDonePercent, //136 SPELL_AURA_MOD_HEALING_DONE_PERCENT &AuraEffect::HandleModTotalPercentStat, //137 SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE &AuraEffect::HandleModMeleeSpeedPct, //138 SPELL_AURA_MOD_MELEE_HASTE &AuraEffect::HandleForceReaction, //139 SPELL_AURA_FORCE_REACTION @@ -3713,6 +3713,30 @@ void AuraEffect::HandleModPowerRegenPCT(AuraApplication const* aurApp, uint8 mod HandleModPowerRegen(aurApp, mode, apply); } +void AuraEffect::HandleModHealingPercent(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const +{ + if (!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT))) + return; + + Player* target = aurApp->GetTarget()->ToPlayer(); + if (!target) + return; + + target->UpdateSpellHealingPercentTaken(); +} + +void AuraEffect::HandleModHealingDonePercent(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const +{ + if (!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT))) + return; + + Player* target = aurApp->GetTarget()->ToPlayer(); + if (!target) + return; + + target->UpdateSpellHealingPercentDone(); +} + void AuraEffect::HandleModManaRegen(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const { if (!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT))) diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.h b/src/server/game/Spells/Auras/SpellAuraEffects.h index 4b877895c2..ea1dbdf6a8 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.h +++ b/src/server/game/Spells/Auras/SpellAuraEffects.h @@ -232,6 +232,8 @@ class TC_GAME_API AuraEffect // heal and energize void HandleModPowerRegen(AuraApplication const* aurApp, uint8 mode, bool apply) const; void HandleModPowerRegenPCT(AuraApplication const* aurApp, uint8 mode, bool apply) const; + void HandleModHealingPercent(AuraApplication const* aurApp, uint8 mode, bool apply) const; + void HandleModHealingDonePercent(AuraApplication const* aurApp, uint8 mode, bool apply) const; void HandleModManaRegen(AuraApplication const* aurApp, uint8 mode, bool apply) const; void HandleAuraModIncreaseHealth(AuraApplication const* aurApp, uint8 mode, bool apply) const; void HandleAuraModIncreaseMaxHealth(AuraApplication const* aurApp, uint8 mode, bool apply) const;