From 9b68e2a93abfc01c4e580bdc9b0775681052e2dd Mon Sep 17 00:00:00 2001 From: Ovahlord Date: Mon, 4 Nov 2019 02:35:40 +0100 Subject: [PATCH] Core/Spells: * Festering Strike will now increase the duration of Frost Fever and Blood Plague up to 6 seconds * Diseases will now properly benefit from their mastery bonus --- .../custom/custom_2019_11_04_01_world.sql | 3 + src/server/scripts/Spells/spell_dk.cpp | 59 ++++++++++++++++++- 2 files changed, 59 insertions(+), 3 deletions(-) create mode 100644 sql/updates/world/custom/custom_2019_11_04_01_world.sql diff --git a/sql/updates/world/custom/custom_2019_11_04_01_world.sql b/sql/updates/world/custom/custom_2019_11_04_01_world.sql new file mode 100644 index 00000000000..b63f1f3b63b --- /dev/null +++ b/sql/updates/world/custom/custom_2019_11_04_01_world.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_script_names` WHERE `ScriptName`= 'spell_dk_festering_strike'; +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(85948, 'spell_dk_festering_strike'); diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp index c43dbfc0a89..844d52406cb 100644 --- a/src/server/scripts/Spells/spell_dk.cpp +++ b/src/server/scripts/Spells/spell_dk.cpp @@ -1487,12 +1487,16 @@ class spell_dk_disease : public AuraScript void CalculateAmount(AuraEffect const* /*aurEff*/, int32 &amount, bool & /*canBeRecalculated*/) { Unit* caster = GetCaster(); - if (!caster) + Unit* target = GetUnitOwner(); + if (!caster || !target) return; - // Formular: ${$m1*1.15+$AP*0.055*1.15} + // Formular: ${$m1 * 1.15 + $AP * 0.055 * 1.15} AddPct(amount, 15); - amount += ((caster->GetTotalAttackPowerValue(BASE_ATTACK) * 0.055f) * 1.15f); + int32 bonus = caster->GetTotalAttackPowerValue(BASE_ATTACK) * 0.055f * 1.15f; + + bonus = caster->SpellDamageBonusDone(target, GetSpellInfo(), bonus, DOT, EFFECT_0); + amount += bonus; } void HandleResilientInfection(DispelInfo* /*dispelInfo*/) @@ -1673,6 +1677,54 @@ class spell_dk_unoly_blight : public AuraScript } }; +// 85948 - Festering Strike +class spell_dk_festering_strike : public SpellScript +{ + PrepareSpellScript(spell_dk_festering_strike); + + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo( + { + SPELL_DK_FROST_FEVER, + SPELL_DK_BLOOD_PLAGUE + }); + } + + void HandleScriptEffect(SpellEffIndex effIndex) + { + Unit* caster = GetCaster(); + if (!caster) + return; + + uint32 durationBonus = GetSpellInfo()->Effects[effIndex].CalcValue(caster) * IN_MILLISECONDS; + for (AuraEffect* disease : GetHitUnit()->GetAuraEffectsByType(SPELL_AURA_PERIODIC_DAMAGE)) + { + if ((disease->GetSpellInfo()->Id == SPELL_DK_FROST_FEVER || disease->GetSpellInfo()->Id == SPELL_DK_BLOOD_PLAGUE) + && disease->GetCasterGUID() == caster->GetGUID()) + { + uint32 maxDuration = disease->GetBase()->GetMaxDuration(); + disease->GetBase()->SetDuration(std::min(maxDuration, disease->GetBase()->GetDuration() + durationBonus)); + } + } + + for (AuraEffect* snare : GetHitUnit()->GetAuraEffectsByType(SPELL_AURA_MOD_DECREASE_SPEED)) + { + SpellInfo const* spellInfo = snare->GetSpellInfo(); + if (spellInfo->SpellFamilyName == SPELLFAMILY_DEATHKNIGHT && spellInfo->SpellFamilyFlags[0] == 0x00000004 && snare->GetCasterGUID() == caster->GetGUID()) + { + uint32 maxDuration = snare->GetBase()->GetMaxDuration(); + snare->GetBase()->SetDuration(std::min(maxDuration, snare->GetBase()->GetDuration() + durationBonus)); + } + } + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_dk_festering_strike::HandleScriptEffect, EFFECT_2, SPELL_EFFECT_SCRIPT_EFFECT); + } +}; + void AddSC_deathknight_spell_scripts() { RegisterAuraScript(spell_dk_anti_magic_shell); @@ -1698,6 +1750,7 @@ void AddSC_deathknight_spell_scripts() RegisterAuraScript(spell_dk_desecration); RegisterAuraScript(spell_dk_disease); RegisterAuraScript(spell_dk_ebon_plaguebringer); + RegisterSpellScript(spell_dk_festering_strike); RegisterSpellScript(spell_dk_ghoul_explode); RegisterSpellScript(spell_dk_ghoul_taunt); RegisterSpellScript(spell_dk_howling_blast);