From 803a7e8f90af3e0d409adea47a170ad4628a0fbd Mon Sep 17 00:00:00 2001 From: Ovahlord Date: Tue, 12 Nov 2019 15:55:56 +0100 Subject: [PATCH] Core/Spells: * use a proper method for handling SPELL_AURA_MOD_DAMAGE_PERCENT_DONE * updated Lava Lash damage bonus formular to work with new weapon effect handling --- .../game/Spells/Auras/SpellAuraEffects.cpp | 6 +- src/server/scripts/Spells/spell_shaman.cpp | 56 +++++++------------ 2 files changed, 21 insertions(+), 41 deletions(-) diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index f1a78b75c7..fdd1a406eb 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -4265,10 +4265,8 @@ void AuraEffect::HandleModDamagePercentDone(AuraApplication const* aurApp, uint8 { if (GetMiscValue() & (1 << i)) { - if (spellGroupVal) - target->ApplyPercentModFloatValue(PLAYER_FIELD_MOD_DAMAGE_DONE_PCT + i, float(spellGroupVal), !apply); - - target->ApplyPercentModFloatValue(PLAYER_FIELD_MOD_DAMAGE_DONE_PCT + i, float(GetAmount()), apply); + float amount = target->GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE, 1 << i); + target->SetFloatValue(PLAYER_FIELD_MOD_DAMAGE_DONE_PCT + i, amount); } } } diff --git a/src/server/scripts/Spells/spell_shaman.cpp b/src/server/scripts/Spells/spell_shaman.cpp index 9c8ea44ec1..d74b98921e 100644 --- a/src/server/scripts/Spells/spell_shaman.cpp +++ b/src/server/scripts/Spells/spell_shaman.cpp @@ -886,47 +886,29 @@ class spell_sha_item_t10_elemental_2p_bonus : public SpellScriptLoader // 60103 - Lava Lash /// Updated 4.3.4 -class spell_sha_lava_lash : public SpellScriptLoader +class spell_sha_lava_lash : public SpellScript { - public: - spell_sha_lava_lash() : SpellScriptLoader("spell_sha_lava_lash") { } + PrepareSpellScript(spell_sha_lava_lash); - class spell_sha_lava_lash_SpellScript : public SpellScript - { - PrepareSpellScript(spell_sha_lava_lash_SpellScript); + bool Load() override + { + return GetCaster()->GetTypeId() == TYPEID_PLAYER; + } - bool Load() override - { - return GetCaster()->GetTypeId() == TYPEID_PLAYER; - } + void HandleDamageBonus(SpellEffIndex /*effIndex*/) + { + Player* caster = GetCaster()->ToPlayer(); - void HandleDummy(SpellEffIndex /*effIndex*/) - { - if (Player* caster = GetCaster()->ToPlayer()) - { - int32 damage = GetEffectValue(); - int32 hitDamage = GetHitDamage(); - if (caster->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND)) - { - // Damage is increased by 25% if your off-hand weapon is enchanted with Flametongue. - if (caster->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_SHAMAN, 0x200000, 0, 0)) - AddPct(hitDamage, damage); - SetHitDamage(hitDamage); - } - } - } + // Increase damage of lava lash by 40% if the offhand weapon is enchanted with Flametongue + if (Item* offhand = caster->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND)) + if (offhand->GetEnchantmentId(TEMP_ENCHANTMENT_SLOT) == SHAMAN_ENCHANTMENT_ID_FLAMETONGUE) + SetEffectValue(GetEffectValue() + GetSpellInfo()->Effects[EFFECT_1].CalcValue(caster)); + } - void Register() override - { - OnEffectHitTarget += SpellEffectFn(spell_sha_lava_lash_SpellScript::HandleDummy, EFFECT_1, SPELL_EFFECT_DUMMY); - } - - }; - - SpellScript* GetSpellScript() const override - { - return new spell_sha_lava_lash_SpellScript(); - } + void Register() override + { + OnEffectLaunchTarget += SpellEffectFn(spell_sha_lava_lash::HandleDamageBonus, EFFECT_0, SPELL_EFFECT_WEAPON_PERCENT_DAMAGE); + } }; class spell_sha_lava_surge : public SpellScriptLoader @@ -2065,7 +2047,7 @@ void AddSC_shaman_spell_scripts() new spell_sha_item_lightning_shield_trigger(); new spell_sha_item_mana_surge(); new spell_sha_item_t10_elemental_2p_bonus(); - new spell_sha_lava_lash(); + RegisterSpellScript(spell_sha_lava_lash); new spell_sha_lava_surge(); new spell_sha_lava_surge_proc(); RegisterAuraScript(spell_sha_lightning_shield);