From 3de0a47105e05480aae35f1df37be181337bf6d4 Mon Sep 17 00:00:00 2001 From: Ovahlord Date: Fri, 26 Jul 2019 11:11:22 +0200 Subject: [PATCH] Core/Spells: removed unneeded spell script for Devastate and updated existing bonus handling in weapon damage effect handler --- .../custom/custom_2019_07_26_00_world.sql | 1 + src/server/game/Spells/SpellEffects.cpp | 18 +++++-------- src/server/scripts/Spells/spell_warrior.cpp | 26 ------------------- 3 files changed, 7 insertions(+), 38 deletions(-) create mode 100644 sql/updates/world/custom/custom_2019_07_26_00_world.sql diff --git a/sql/updates/world/custom/custom_2019_07_26_00_world.sql b/sql/updates/world/custom/custom_2019_07_26_00_world.sql new file mode 100644 index 00000000000..63adaed47dd --- /dev/null +++ b/sql/updates/world/custom/custom_2019_07_26_00_world.sql @@ -0,0 +1 @@ +DELETE FROM `spell_script_names` WHERE `ScriptName`= 'spell_warr_devastate'; diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 02bf8b03ef4..d714ffdbaca 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -2788,20 +2788,14 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex) { case SPELLFAMILY_WARRIOR: { - // Devastate (player ones) - if (m_spellInfo->SpellFamilyFlags[1] & 0x40) + // Devastate + if (m_spellInfo->SpellFamilyFlags[1] & 0x40 && effIndex == EFFECT_1) { - // Player can apply only 58567 Sunder Armor effect. - bool needCast = !unitTarget->HasAura(58567, m_caster->GetGUID()); - if (needCast) - m_caster->CastSpell(unitTarget, 58567, true); - if (Aura* aur = unitTarget->GetAura(58567, m_caster->GetGUID())) - { - if (int32 num = (needCast ? 0 : 1)) - aur->ModStackAmount(num); - fixed_bonus += (aur->GetStackAmount() - 1) * CalculateDamage(2, unitTarget); - } + fixed_bonus += aur->GetStackAmount() * CalculateDamage(EFFECT_1, unitTarget); + + // Devastate applies Sunder Armor on the target + m_caster->CastSpell(unitTarget, 58567, true); } break; } diff --git a/src/server/scripts/Spells/spell_warrior.cpp b/src/server/scripts/Spells/spell_warrior.cpp index 8b3bac39e4d..dd0d669989e 100644 --- a/src/server/scripts/Spells/spell_warrior.cpp +++ b/src/server/scripts/Spells/spell_warrior.cpp @@ -1163,31 +1163,6 @@ class spell_warr_shield_specialization : public AuraScript } }; -class spell_warr_devastate : public SpellScript -{ - PrepareSpellScript(spell_warr_devastate); - - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo({ SPELL_WARRIOR_SUNDER_ARMOR }); - } - - void HandleBonusDamage(SpellEffIndex effIndex) - { - if (Aura* aura = GetHitUnit()->GetAura(SPELL_WARRIOR_SUNDER_ARMOR)) - { - uint8 stacks = std::max(0, aura->GetStackAmount() - 1); - int32 damage = GetSpellInfo()->Effects[effIndex].CalcValue(GetCaster(), nullptr, GetHitUnit()); - SetHitDamage(GetHitDamage() + (stacks * damage)); - } - } - - void Register() override - { - OnEffectHitTarget += SpellEffectFn(spell_warr_devastate::HandleBonusDamage, EFFECT_1, SPELL_EFFECT_NORMALIZED_WEAPON_DMG); - } -}; - class spell_warr_blood_craze : public AuraScript { PrepareAuraScript(spell_warr_blood_craze); @@ -1228,7 +1203,6 @@ void AddSC_warrior_spell_scripts() new spell_warr_bloodthirst_heal(); new spell_warr_charge(); RegisterSpellScript(spell_warr_concussion_blow); - RegisterSpellScript(spell_warr_devastate); new spell_warr_deep_wounds(); new spell_warr_execute(); new spell_warr_glyph_of_sunder_armor();