diff options
author | ariel- <ariel-@users.noreply.github.com> | 2018-01-20 19:08:03 -0300 |
---|---|---|
committer | ariel- <ariel-@users.noreply.github.com> | 2018-01-20 19:08:03 -0300 |
commit | cb75105434f5002ae53aef2c9c2e6417eaf8f5f0 (patch) | |
tree | 11b377d0eaea113868e3a5f04c535da6ce7ca1b9 /src | |
parent | 946856258cf004e35b9150c60b3bc7de859a72b7 (diff) |
Core/Scripts: fix Wild Growth losing info about caster bonuses
Closes #21281
Diffstat (limited to 'src')
-rw-r--r-- | src/server/scripts/Spells/spell_druid.cpp | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/src/server/scripts/Spells/spell_druid.cpp b/src/server/scripts/Spells/spell_druid.cpp index 859f097d638..526157708ad 100644 --- a/src/server/scripts/Spells/spell_druid.cpp +++ b/src/server/scripts/Spells/spell_druid.cpp @@ -2312,29 +2312,34 @@ class spell_dru_wild_growth : public SpellScriptLoader return ValidateSpellInfo({ SPELL_DRUID_RESTORATION_T10_2P_BONUS }); } - void HandleTickUpdate(AuraEffect* aurEff) + void SetTickHeal(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) { - Unit* caster = GetCaster(); - if (!caster) - return; - - // calculate from base damage, not from aurEff->GetAmount() (already modified) - float damage = caster->CalculateSpellDamage(GetUnitOwner(), GetSpellInfo(), aurEff->GetEffIndex()); + // includes caster bonuses already + _baseTick = amount; + if (Unit* caster = GetCaster()) + if (AuraEffect const* bonus = caster->GetAuraEffect(SPELL_DRUID_RESTORATION_T10_2P_BONUS, EFFECT_0)) + AddPct(_baseReduction, -bonus->GetAmount()); + } + void HandleTickUpdate(AuraEffect* aurEff) + { // Wild Growth = first tick gains a 6% bonus, reduced by 2% each tick - float reduction = 2.f; - if (AuraEffect* bonus = caster->GetAuraEffect(SPELL_DRUID_RESTORATION_T10_2P_BONUS, EFFECT_0)) - reduction -= CalculatePct(reduction, bonus->GetAmount()); + float reduction = _baseReduction; reduction *= (aurEff->GetTickNumber() - 1); - AddPct(damage, 6.f - reduction); - aurEff->SetAmount(int32(damage)); + float const bonus = 6.f - reduction; + int32 const amount = int32(_baseTick + CalculatePct(_baseTick, bonus)); + aurEff->SetAmount(amount); } void Register() override { + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dru_wild_growth_AuraScript::SetTickHeal, EFFECT_0, SPELL_AURA_PERIODIC_HEAL); OnEffectUpdatePeriodic += AuraEffectUpdatePeriodicFn(spell_dru_wild_growth_AuraScript::HandleTickUpdate, EFFECT_0, SPELL_AURA_PERIODIC_HEAL); } + + float _baseTick = 0.f; + float _baseReduction = 2.f; }; SpellScript* GetSpellScript() const override |