diff --git a/data/sql/updates/pending_db_world/rev_1720633619992216684.sql b/data/sql/updates/pending_db_world/rev_1720633619992216684.sql new file mode 100644 index 000000000..eff1ca20a --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1720633619992216684.sql @@ -0,0 +1,5 @@ +-- +DELETE FROM `spell_script_names` WHERE `spell_id` IN (53646, 54909); +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(53646, 'spell_warl_demonic_pact_aura'), +(54909, 'spell_warl_demonic_pact_aura'); diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 0a48b0a2c..0b4c13dea 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -9692,30 +9692,6 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg return false; break; } - // Demonic Pact - case 48090: - { - // Get talent aura from owner - if (IsPet()) - if (Unit* owner = GetOwner()) - { - if (HasSpellCooldown(trigger_spell_id)) - return false; - AddSpellCooldown(trigger_spell_id, 0, cooldown); - - if (AuraEffect* aurEff = owner->GetDummyAuraEffect(SPELLFAMILY_WARLOCK, 3220, 0)) - { - int32 spellPower = owner->SpellBaseDamageBonusDone(SpellSchoolMask(SPELL_SCHOOL_MASK_MAGIC)); - if (AuraEffect const* demonicAuraEffect = GetAuraEffect(trigger_spell_id, EFFECT_0)) - spellPower -= demonicAuraEffect->GetAmount(); - - basepoints0 = int32((aurEff->GetAmount() * spellPower + 100.0f) / 100.0f); - CastCustomSpell(this, trigger_spell_id, &basepoints0, &basepoints0, nullptr, true, castItem, triggeredByAura); - return true; - } - } - break; - } case 46916: // Slam! (Bloodsurge proc) case 52437: // Sudden Death { diff --git a/src/server/game/Spells/SpellInfoCorrections.cpp b/src/server/game/Spells/SpellInfoCorrections.cpp index e0387de8f..13b146f35 100644 --- a/src/server/game/Spells/SpellInfoCorrections.cpp +++ b/src/server/game/Spells/SpellInfoCorrections.cpp @@ -4699,12 +4699,6 @@ void SpellMgr::LoadSpellInfoCorrections() spellInfo->AttributesEx2 |= SPELL_ATTR2_IGNORE_LINE_OF_SIGHT; }); - // Demonic Pact - ApplySpellFix({ 48090 }, [](SpellInfo* spellInfo) - { - spellInfo->AttributesEx2 |= SPELL_ATTR2_IGNORE_LINE_OF_SIGHT; - }); - // Ancestral Awakening ApplySpellFix({ 52759 }, [](SpellInfo* spellInfo) { diff --git a/src/server/scripts/Spells/spell_warlock.cpp b/src/server/scripts/Spells/spell_warlock.cpp index 73d053a3d..d9601ebef 100644 --- a/src/server/scripts/Spells/spell_warlock.cpp +++ b/src/server/scripts/Spells/spell_warlock.cpp @@ -65,12 +65,14 @@ enum WarlockSpells SPELL_WARLOCK_IMPROVED_DRAIN_SOUL_PROC = 18371, SPELL_WARLOCK_EYE_OF_KILROGG_FLY = 58083, SPELL_WARLOCK_PET_VOID_STAR_TALISMAN = 37386, // Void Star Talisman + SPELL_WARLOCK_DEMONIC_PACT_PROC = 48090, }; enum WarlockSpellIcons { WARLOCK_ICON_ID_IMPROVED_LIFE_TAP = 208, - WARLOCK_ICON_ID_MANA_FEED = 1982 + WARLOCK_ICON_ID_MANA_FEED = 1982, + WARLOCK_ICON_ID_DEMONIC_PACT = 3220 }; class spell_warl_eye_of_kilrogg : public AuraScript @@ -1321,6 +1323,54 @@ class spell_warl_glyph_of_voidwalker : public AuraScript } }; +// 54909, 53646 - Demonic Pact +class spell_warl_demonic_pact_aura : public AuraScript +{ + PrepareAuraScript(spell_warl_demonic_pact_aura); + + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_WARLOCK_DEMONIC_PACT_PROC }); + } + + bool AfterCheckProc(ProcEventInfo& eventInfo, bool isTriggeredAtSpellProcEvent) + { + return isTriggeredAtSpellProcEvent && eventInfo.GetActor() && eventInfo.GetActor()->IsPet(); + } + + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + { + PreventDefaultAction(); + + if (eventInfo.GetActor()->HasSpellCooldown(aurEff->GetId())) + return; + + if (Unit* owner = eventInfo.GetActor()->GetOwner()) + { + int32 currentBonus = 0; + if (AuraEffect* demonicAurEff = owner->GetAuraEffect(SPELL_WARLOCK_DEMONIC_PACT_PROC, EFFECT_0)) + { + currentBonus = demonicAurEff->GetAmount(); + } + + if (AuraEffect* talentAurEff = owner->GetDummyAuraEffect(SPELLFAMILY_WARLOCK, WARLOCK_ICON_ID_DEMONIC_PACT, EFFECT_0)) + { + int32 spellDamageMinusBonus = owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_MAGIC) - currentBonus; + if (spellDamageMinusBonus < 0) + return; + int32 bp = int32((talentAurEff->GetAmount() / 100.0f) * spellDamageMinusBonus); + owner->CastCustomSpell((Unit*)nullptr, SPELL_WARLOCK_DEMONIC_PACT_PROC, &bp, &bp, 0, true, nullptr, talentAurEff); + eventInfo.GetActor()->AddSpellCooldown(aurEff->GetId(), 0, eventInfo.GetProcCooldown()); + } + } + } + + void Register() override + { + OnEffectProc += AuraEffectProcFn(spell_warl_demonic_pact_aura::HandleProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL); + } +}; + void AddSC_warlock_spell_scripts() { RegisterSpellScript(spell_warl_eye_of_kilrogg); @@ -1354,5 +1404,6 @@ void AddSC_warlock_spell_scripts() RegisterSpellScript(spell_warl_shadowburn); RegisterSpellScript(spell_warl_glyph_of_felguard); RegisterSpellScript(spell_warl_glyph_of_voidwalker); + RegisterSpellScript(spell_warl_demonic_pact_aura); }