From e294044787eb5980ebc065f0e024fd3b59b72011 Mon Sep 17 00:00:00 2001 From: Ovahlord Date: Sat, 17 Mar 2018 13:15:22 +0100 Subject: [PATCH] Core/Spells: Drain Soul will now properly grant Soul Shards while channeling. * moved Soul Shard handling to aurascript --- .../4.3.4/custom_2018_03_17_01_world.sql | 4 ++ .../game/Spells/Auras/SpellAuraEffects.cpp | 7 +-- src/server/scripts/Spells/spell_warlock.cpp | 49 +++++++++++++++++++ 3 files changed, 54 insertions(+), 6 deletions(-) create mode 100644 sql/updates/world/4.3.4/custom_2018_03_17_01_world.sql diff --git a/sql/updates/world/4.3.4/custom_2018_03_17_01_world.sql b/sql/updates/world/4.3.4/custom_2018_03_17_01_world.sql new file mode 100644 index 00000000000..69439c0b846 --- /dev/null +++ b/sql/updates/world/4.3.4/custom_2018_03_17_01_world.sql @@ -0,0 +1,4 @@ +DELETE FROM `spell_script_names` WHERE `ScriptName`= 'spell_warl_drain_soul'; + +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(1120, 'spell_warl_drain_soul'); diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 49afd991691..c4240cbc971 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -5559,12 +5559,7 @@ void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const damage += (damage+1)/2; // +1 prevent 0.5 damage possible lost at 1..4 ticks // 5..8 ticks have normal tick damage } - // There is a Chance to make a Soul Shard when Drain soul does damage - if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_WARLOCK && (GetSpellInfo()->SpellFamilyFlags[0] & 0x00004000)) - { - if (caster->GetTypeId() == TYPEID_PLAYER && caster->ToPlayer()->isHonorOrXPTarget(target)) - caster->CastSpell(caster, 95810, true, 0, this); - } + if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_GENERIC) { switch (GetId()) diff --git a/src/server/scripts/Spells/spell_warlock.cpp b/src/server/scripts/Spells/spell_warlock.cpp index 4cd97a1177b..38231715d14 100644 --- a/src/server/scripts/Spells/spell_warlock.cpp +++ b/src/server/scripts/Spells/spell_warlock.cpp @@ -72,6 +72,8 @@ enum WarlockSpells SPELL_WARLOCK_SHADOW_TRANCE = 17941, SPELL_WARLOCK_SIPHON_LIFE_HEAL = 63106, SPELL_WARLOCK_SHADOW_WARD = 6229, + SPELL_WARLOCK_SOUL_SHARD = 87388, + SPELL_WARLOCK_SOUL_SHARD_ENERGIZE = 95810, SPELL_WARLOCK_SOULSHATTER = 32835, SPELL_WARLOCK_SOUL_SWAP_CD_MARKER = 94229, SPELL_WARLOCK_SOUL_SWAP_OVERRIDE = 86211, @@ -1574,6 +1576,52 @@ class spell_warl_drain_life_heal : public SpellScriptLoader } }; +// 1120 - Drain Soul +class spell_warl_drain_soul : public SpellScriptLoader +{ + public: + spell_warl_drain_soul() : SpellScriptLoader("spell_warl_drain_soul") { } + + class spell_warl_drain_soul_AuraScript : public AuraScript + { + PrepareAuraScript(spell_warl_drain_soul_AuraScript); + + bool Validate(SpellInfo const* /*spellInfo*/) + { + return ValidateSpellInfo( + { + SPELL_WARLOCK_SOUL_SHARD, + SPELL_WARLOCK_SOUL_SHARD_ENERGIZE + }); + } + + void HandlePeriodic(AuraEffect const* aurEff) + { + if (Unit* caster = GetCaster()) + GetCaster()->CastSpell(GetCaster(), SPELL_WARLOCK_SOUL_SHARD, true, 0, aurEff); + } + + void OnAuraRemoveHandler(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + { + if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_DEATH) + if (Unit* caster = GetCaster()) + if (GetOwner() && caster->ToPlayer() && caster->ToPlayer()->isHonorOrXPTarget(GetOwner()->ToUnit())) + caster->CastSpell(caster, SPELL_WARLOCK_SOUL_SHARD_ENERGIZE, true); + } + + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_warl_drain_soul_AuraScript::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE); + AfterEffectRemove += AuraEffectRemoveFn(spell_warl_drain_soul_AuraScript::OnAuraRemoveHandler, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAL); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_warl_drain_soul_AuraScript(); + } +}; + void AddSC_warlock_spell_scripts() { new spell_warl_aftermath(); @@ -1587,6 +1635,7 @@ void AddSC_warlock_spell_scripts() new spell_warl_demon_soul(); new spell_warl_drain_life(); new spell_warl_drain_life_heal(); + new spell_warl_drain_soul(); new spell_warl_everlasting_affliction(); new spell_warl_fel_flame(); new spell_warl_fel_synergy();