diff --git a/data/sql/updates/pending_db_world/rev_1719253714347835736.sql b/data/sql/updates/pending_db_world/rev_1719253714347835736.sql new file mode 100644 index 000000000..dbb2a2e77 --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1719253714347835736.sql @@ -0,0 +1,13 @@ +-- +UPDATE `spell_script_names` SET `ScriptName`='spell_warl_seed_of_corruption_damage' WHERE `spell_id` = -27285 AND `ScriptName` = 'spell_warl_seed_of_corruption'; +DELETE FROM `spell_script_names` WHERE `spell_id` = 32865 AND `ScriptName` = 'spell_warl_seed_of_corruption_damage'; +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES(32865, 'spell_warl_seed_of_corruption_damage'); +DELETE FROM `spell_script_names` WHERE `spell_id` = -27243 AND `ScriptName` = 'spell_warl_seed_of_corruption_aura'; +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES (-27243, 'spell_warl_seed_of_corruption_aura'); +DELETE FROM `spell_script_names` WHERE `spell_id` IN (32863, 38252, 44141, 70388) AND `ScriptName` = 'spell_warl_seed_of_corruption_generic_aura'; +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(32863, 'spell_warl_seed_of_corruption_generic_aura'), +(38252, 'spell_warl_seed_of_corruption_generic_aura'), +(44141, 'spell_warl_seed_of_corruption_generic_aura'), +(70388, 'spell_warl_seed_of_corruption_generic_aura'); +UPDATE `spell_script_names` SET `ScriptName`='spell_warl_seed_of_corruption_generic_aura' WHERE `spell_id` IN (36123, 39367) AND `ScriptName` = 'spell_zereketh_seed_of_corruption'; diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index b09f8756c..78a832ca6 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -7131,60 +7131,6 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere } case SPELLFAMILY_WARLOCK: { - // Seed of Corruption - if (dummySpell->SpellFamilyFlags[1] & 0x00000010) - { - if (procSpell && procSpell->SpellFamilyFlags[1] & 0x8000) - return false; - // if damage is more than need or target die from damage deal finish spell - if (triggeredByAura->GetAmount() <= int32(damage) || GetHealth() <= damage) - { - // remember guid before aura delete - ObjectGuid casterGuid = triggeredByAura->GetCasterGUID(); - - // Remove aura (before cast for prevent infinite loop handlers) - RemoveAurasDueToSpell(triggeredByAura->GetId()); - - uint32 spell = sSpellMgr->GetSpellWithRank(27285, dummySpell->GetRank()); - - // Cast finish spell (triggeredByAura already not exist!) - if (Unit* caster = ObjectAccessor::GetUnit(*this, casterGuid)) - { - this->CastSpell(this, 37826, true); // VISUAL! - caster->CastSpell(this, spell, true, castItem); - } - - return true; // no hidden cooldown - } - - // Damage counting - triggeredByAura->SetAmount(triggeredByAura->GetAmount() - damage); - return true; - } - // Seed of Corruption (Mobs cast) - no die req - if (dummySpell->SpellFamilyFlags.IsEqual(0, 0, 0) && dummySpell->SpellIconID == 1932) - { - // if damage is more than need deal finish spell - if (triggeredByAura->GetAmount() <= int32(damage)) - { - // remember guid before aura delete - ObjectGuid casterGuid = triggeredByAura->GetCasterGUID(); - - // Remove aura (before cast for prevent infinite loop handlers) - RemoveAurasDueToSpell(triggeredByAura->GetId()); - - // Cast finish spell (triggeredByAura already not exist!) - if (Unit* caster = ObjectAccessor::GetUnit(*this, casterGuid)) - { - this->CastSpell(this, 37826, true); // VISUAL! - caster->CastSpell(this, 32865, true, castItem); - } - return true; // no hidden cooldown - } - // Damage counting - triggeredByAura->SetAmount(triggeredByAura->GetAmount() - damage); - return true; - } switch (dummySpell->Id) { // Nightfall diff --git a/src/server/scripts/Outland/TempestKeep/arcatraz/boss_zereketh_the_unbound.cpp b/src/server/scripts/Outland/TempestKeep/arcatraz/boss_zereketh_the_unbound.cpp index 29994ec1d..e4ff14b1b 100644 --- a/src/server/scripts/Outland/TempestKeep/arcatraz/boss_zereketh_the_unbound.cpp +++ b/src/server/scripts/Outland/TempestKeep/arcatraz/boss_zereketh_the_unbound.cpp @@ -79,37 +79,8 @@ struct boss_zereketh_the_unbound : public BossAI } }; -// 36123, 39367 -- Seed of Corruption -class spell_zereketh_seed_of_corruption: public AuraScript -{ - PrepareAuraScript(spell_zereketh_seed_of_corruption); - - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo({ SPELL_CORRUPTION_PROC }); - } - - void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& /*eventInfo*/) - { - PreventDefaultAction(); - uint32 val = GetSpellInfo()->GetEffect(EFFECT_1).BasePoints; - GetTarget()->RemoveAurasDueToSpell(GetSpellInfo()->Id); - - if (GetCaster()) - { - GetCaster()->CastCustomSpell(SPELL_CORRUPTION_PROC, SPELLVALUE_BASE_POINT0, val, GetTarget(), true); - } - } - - void Register() override - { - OnEffectProc += AuraEffectProcFn(spell_zereketh_seed_of_corruption::HandleProc, EFFECT_1, SPELL_AURA_DUMMY); - } -}; - void AddSC_boss_zereketh_the_unbound() { RegisterArcatrazCreatureAI(boss_zereketh_the_unbound); - RegisterSpellScript(spell_zereketh_seed_of_corruption); } diff --git a/src/server/scripts/Spells/spell_warlock.cpp b/src/server/scripts/Spells/spell_warlock.cpp index d9601ebef..7d96f4fd9 100644 --- a/src/server/scripts/Spells/spell_warlock.cpp +++ b/src/server/scripts/Spells/spell_warlock.cpp @@ -58,6 +58,12 @@ enum WarlockSpells SPELL_WARLOCK_IMPROVED_HEALTH_FUNNEL_BUFF_R2 = 60956, SPELL_WARLOCK_LIFE_TAP_ENERGIZE = 31818, SPELL_WARLOCK_LIFE_TAP_ENERGIZE_2 = 32553, + SPELL_WARLOCK_SEED_OF_CORRUPTION_R1 = 27243, + SPELL_WARLOCK_SEED_OF_CORRUPTION_DAMAGE_R1 = 27285, + SPELL_WARLOCK_SEED_OF_CORRUPTION_DAMAGE_R2 = 47833, + SPELL_WARLOCK_SEED_OF_CORRUPTION_DAMAGE_R3 = 47834, + SPELL_WARLOCK_SEED_OF_CORRUPTION_DAMAGE_GENERIC = 32865, + SPELL_WARLOCK_SEED_OF_CORRUPTION_VISUAL = 37826, SPELL_WARLOCK_SOULSHATTER = 32835, SPELL_WARLOCK_SIPHON_LIFE_HEAL = 63106, SPELL_WARLOCK_UNSTABLE_AFFLICTION_DISPEL = 31117, @@ -672,9 +678,10 @@ class spell_warl_ritual_of_doom_effect : public SpellScript }; // -27285 - Seed of Corruption -class spell_warl_seed_of_corruption : public SpellScript +// 32865 - Seed of Corruption +class spell_warl_seed_of_corruption_damage : public SpellScript { - PrepareSpellScript(spell_warl_seed_of_corruption); + PrepareSpellScript(spell_warl_seed_of_corruption_damage); void FilterTargets(std::list& targets) { @@ -697,7 +704,124 @@ class spell_warl_seed_of_corruption : public SpellScript void Register() override { - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_warl_seed_of_corruption::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_warl_seed_of_corruption_damage::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY); + } +}; + +// -27243 - Seed of Corruption +class spell_warl_seed_of_corruption_aura: public AuraScript +{ + PrepareAuraScript(spell_warl_seed_of_corruption_aura); + + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ + SPELL_WARLOCK_SEED_OF_CORRUPTION_DAMAGE_R1, + SPELL_WARLOCK_SEED_OF_CORRUPTION_DAMAGE_R2, + SPELL_WARLOCK_SEED_OF_CORRUPTION_DAMAGE_R3, + SPELL_WARLOCK_SEED_OF_CORRUPTION_VISUAL + }); + } + + void CalculateAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + { + if (!GetCaster()) + return; + + // effect 1 scales with 14% of caster's SP (DBC data) + amount = GetCaster()->SpellDamageBonusDone(GetUnitOwner(), GetSpellInfo(), amount, DOT, aurEff->GetEffIndex(), aurEff->GetPctMods()); + } + + void Detonate(AuraEffect const* aurEff) + { + if (!GetCaster() || !GetTarget()) + return; + + GetTarget()->CastSpell(GetTarget(), SPELL_WARLOCK_SEED_OF_CORRUPTION_VISUAL, true, nullptr, aurEff); + GetCaster()->CastSpell(GetTarget(), sSpellMgr->GetSpellWithRank(SPELL_WARLOCK_SEED_OF_CORRUPTION_DAMAGE_R1, GetSpellInfo()->GetRank()), true, nullptr, aurEff); + } + + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + { + PreventDefaultAction(); + DamageInfo* damageInfo = eventInfo.GetDamageInfo(); + if (!damageInfo || !damageInfo->GetDamage()) + return; + + int32 remainingDamage = aurEff->GetAmount() - damageInfo->GetDamage(); + if (remainingDamage > 0) + { + GetAura()->GetEffect(EFFECT_1)->SetAmount(remainingDamage); + } + else // damage threshold has been reached + { + Remove(AURA_REMOVE_BY_DEFAULT); + Detonate(aurEff); + } + } + + void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + { + AuraRemoveMode removeMode = GetTargetApplication()->GetRemoveMode(); + if (removeMode == AURA_REMOVE_BY_DEATH) + Detonate(aurEff); + } + + void Register() override + { + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_seed_of_corruption_aura::CalculateAmount, EFFECT_1, SPELL_AURA_DUMMY); + AfterEffectRemove += AuraEffectRemoveFn(spell_warl_seed_of_corruption_aura::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAL); + OnEffectProc += AuraEffectProcFn(spell_warl_seed_of_corruption_aura::HandleProc, EFFECT_1, SPELL_AURA_DUMMY); + } +}; + +// Monster spells, triggered only on detonation threshold reached (not on death) +// 32863 - Seed of Corruption +// 36123 - Seed of Corruption +// 38252 - Seed of Corruption +// 39367 - Seed of Corruption +// 44141 - Seed of Corruption +// 70388 - Seed of Corruption +class spell_warl_seed_of_corruption_generic_aura: public AuraScript +{ + PrepareAuraScript(spell_warl_seed_of_corruption_generic_aura); + + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_WARLOCK_SEED_OF_CORRUPTION_DAMAGE_GENERIC, SPELL_WARLOCK_SEED_OF_CORRUPTION_VISUAL }); + } + + void Detonate(AuraEffect const* aurEff) + { + if (!GetCaster() || !GetTarget()) + return; + + GetTarget()->CastSpell(GetTarget(), SPELL_WARLOCK_SEED_OF_CORRUPTION_VISUAL, true, nullptr, aurEff); + GetCaster()->CastCustomSpell(SPELL_WARLOCK_SEED_OF_CORRUPTION_DAMAGE_GENERIC, SPELLVALUE_BASE_POINT0, GetSpellInfo()->GetEffect(EFFECT_1).CalcValue(), GetTarget(), true, nullptr, aurEff); + } + + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + { + PreventDefaultAction(); + DamageInfo* damageInfo = eventInfo.GetDamageInfo(); + if (!damageInfo || !damageInfo->GetDamage()) + return; + + int32 remainingDamage = aurEff->GetAmount() - damageInfo->GetDamage(); + if (remainingDamage > 0) + { + GetAura()->GetEffect(EFFECT_1)->SetAmount(remainingDamage); + } + else // damage threshold has been reached + { + Remove(AURA_REMOVE_BY_DEFAULT); + Detonate(aurEff); + } + } + + void Register() override + { + OnEffectProc += AuraEffectProcFn(spell_warl_seed_of_corruption_generic_aura::HandleProc, EFFECT_1, SPELL_AURA_DUMMY); } }; @@ -1395,7 +1519,9 @@ void AddSC_warlock_spell_scripts() RegisterSpellScript(spell_warl_health_funnel); RegisterSpellScript(spell_warl_life_tap); RegisterSpellScript(spell_warl_ritual_of_doom_effect); - RegisterSpellScript(spell_warl_seed_of_corruption); + RegisterSpellScript(spell_warl_seed_of_corruption_damage); + RegisterSpellScript(spell_warl_seed_of_corruption_aura); + RegisterSpellScript(spell_warl_seed_of_corruption_generic_aura); RegisterSpellScript(spell_warl_shadow_ward); RegisterSpellScript(spell_warl_siphon_life); RegisterSpellScript(spell_warl_soulshatter);