diff options
author | ariel- <ariel-@users.noreply.github.com> | 2017-06-02 14:12:53 -0300 |
---|---|---|
committer | funjoker <funjoker109@gmail.com> | 2020-06-14 23:49:05 +0200 |
commit | 7c2e83604cf099280eb67ecb3713368cc02febe5 (patch) | |
tree | 94beebd2a564627bc282be8f28a92d40eb1226a5 | |
parent | 8e44a6a3817b0feb672c897a7e95a8d98e40de49 (diff) |
Core/Scripts: moved Wild Growth calculation to script and fixed formula
Thanks ccrs for the formula
(cherry picked from commit 96ee23487fe2a5fc2cf79e5d2ec4ec38b965e70d)
-rw-r--r-- | src/server/game/Spells/Auras/SpellAuraEffects.cpp | 12 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_druid.cpp | 41 |
2 files changed, 40 insertions, 13 deletions
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index aef183d8b97..2db4d4f8b3c 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -5896,18 +5896,6 @@ void AuraEffect::HandlePeriodicHealAurasTick(Unit* target, Unit* caster) const } else { - // Wild Growth = amount + (6 - 2*doneTicks) * ticks* amount / 100 - if (m_spellInfo->SpellFamilyName == SPELLFAMILY_DRUID && m_spellInfo->SpellFamilyFlags & flag128(0, 0x04000000, 0, 0)) - { - int32 addition = int32(float(damage * GetTotalTicks()) * ((6-float(2*(GetTickNumber()-1)))/100)); - - // Item - Druid T10 Restoration 2P Bonus - if (AuraEffect* aurEff = caster->GetAuraEffect(70658, 0)) - // divided by 50 instead of 100 because calculated as for every 2 tick - addition += abs(int32((addition * aurEff->GetAmount()) / 50)); - - damage += addition; - } if (isAreaAura) damage = caster->SpellHealingBonusDone(target, GetSpellInfo(), damage, DOT, GetSpellEffectInfo(), GetBase()->GetStackAmount()) * caster->SpellHealingPctDone(target, m_spellInfo); damage = target->SpellHealingBonusTaken(caster, GetSpellInfo(), damage, DOT, GetSpellEffectInfo(), GetBase()->GetStackAmount()); diff --git a/src/server/scripts/Spells/spell_druid.cpp b/src/server/scripts/Spells/spell_druid.cpp index 48d63353a34..b0e52234c13 100644 --- a/src/server/scripts/Spells/spell_druid.cpp +++ b/src/server/scripts/Spells/spell_druid.cpp @@ -66,6 +66,7 @@ enum DruidSpells SPELL_DRUID_REJUVENATION_T10_PROC = 70691, SPELL_DRUID_BALANCE_T10_BONUS = 70718, SPELL_DRUID_BALANCE_T10_BONUS_PROC = 70721, + SPELL_DRUID_RESTORATION_T10_2P_BONUS = 70658, SPELL_DRUID_SUNFIRE_DAMAGE = 164815, SPELL_DRUID_SURVIVAL_INSTINCTS = 50322 }; @@ -1434,14 +1435,52 @@ public: OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_dru_wild_growth_SpellScript::SetTargets, EFFECT_1, TARGET_UNIT_DEST_AREA_ALLY); } - private: std::list<WorldObject*> _targets; }; + class spell_dru_wild_growth_AuraScript : public AuraScript + { + PrepareAuraScript(spell_dru_wild_growth_AuraScript); + + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_DRUID_RESTORATION_T10_2P_BONUS }); + } + + void HandleTickUpdate(AuraEffect* aurEff) + { + Unit* caster = GetCaster(); + if (!caster) + return; + + // calculate from base damage, not from aurEff->GetAmount() (already modified) + float damage = caster->CalculateSpellDamage(GetUnitOwner(), GetSpellInfo(), aurEff->GetEffIndex()); + + // 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()); + reduction *= (aurEff->GetTickNumber() - 1); + + AddPct(damage, 6.f - reduction); + aurEff->SetAmount(int32(damage)); + } + + void Register() override + { + OnEffectUpdatePeriodic += AuraEffectUpdatePeriodicFn(spell_dru_wild_growth_AuraScript::HandleTickUpdate, EFFECT_0, SPELL_AURA_PERIODIC_HEAL); + } + }; + SpellScript* GetSpellScript() const override { return new spell_dru_wild_growth_SpellScript(); } + + AuraScript* GetAuraScript() const override + { + return new spell_dru_wild_growth_AuraScript(); + } }; void AddSC_druid_spell_scripts() |