diff --git a/data/sql/updates/pending_db_world/rev_1772186400000000000.sql b/data/sql/updates/pending_db_world/rev_1772186400000000000.sql new file mode 100644 index 000000000..5445b657a --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1772186400000000000.sql @@ -0,0 +1,5 @@ +-- Cobra Strikes spell script bindings +DELETE FROM `spell_script_names` WHERE `spell_id` IN (-53256, 53257); +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(-53256, 'spell_hun_cobra_strikes'), +(53257, 'spell_hun_cobra_strikes_triggered'); diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 9f63466b1..56604d76e 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -13040,6 +13040,23 @@ void Unit::TriggerAurasProcOnEvent(std::list* myProcAuras, std AuraApplicationProcContainer myAurasTriggeringProc; GetProcAurasTriggeredOnEvent(myAurasTriggeringProc, myProcAuras, myProcEventInfo); + // needed for example for Cobra Strikes, pet does the attack, but aura is on owner + if (Player* modOwner = GetSpellModOwner()) + { + if (modOwner != this && spell) + { + std::list modAuras; + for (auto itr = modOwner->GetAppliedAuras().begin(); itr != modOwner->GetAppliedAuras().end(); ++itr) + { + if (spell->m_appliedMods.count(itr->second->GetBase()) != 0) + modAuras.push_back(itr->second); + } + + if (!modAuras.empty()) + modOwner->GetProcAurasTriggeredOnEvent(myAurasTriggeringProc, &modAuras, myProcEventInfo); + } + } + // prepare data for target trigger ProcEventInfo targetProcEventInfo = ProcEventInfo(this, actionTarget, this, typeMaskActionTarget, spellTypeMask, spellPhaseMask, hitMask, spell, damageInfo, healInfo); AuraApplicationProcContainer targetAurasTriggeringProc; diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp index 209a54923..978f73d9f 100644 --- a/src/server/game/Spells/SpellInfo.cpp +++ b/src/server/game/Spells/SpellInfo.cpp @@ -1313,10 +1313,10 @@ bool SpellInfo::IsAffectedBySpellMod(SpellModifier const* mod) const if (affectSpell->SpellFamilyName != SpellFamilyName) return false; - if (mod->mask & SpellFamilyFlags) - return true; + if (mod->mask && !(mod->mask & SpellFamilyFlags)) + return false; - return false; + return true; } bool SpellInfo::CanPierceImmuneAura(SpellInfo const* aura) const diff --git a/src/server/game/Spells/SpellInfoCorrections.cpp b/src/server/game/Spells/SpellInfoCorrections.cpp index dc5218fba..8553143a5 100644 --- a/src/server/game/Spells/SpellInfoCorrections.cpp +++ b/src/server/game/Spells/SpellInfoCorrections.cpp @@ -652,13 +652,6 @@ void SpellMgr::LoadSpellInfoCorrections() spellInfo->AttributesEx3 |= SPELL_ATTR3_ALWAYS_HIT; }); - // Cobra Strikes - ApplySpellFix({ 53257 }, [](SpellInfo* spellInfo) - { - spellInfo->ProcCharges = 2; - spellInfo->StackAmount = 0; - }); - // Kill Command // Kill Command, Overpower ApplySpellFix({ 34027, 37529 }, [](SpellInfo* spellInfo) diff --git a/src/server/scripts/Spells/spell_hunter.cpp b/src/server/scripts/Spells/spell_hunter.cpp index 7877a9bd9..fce48f898 100644 --- a/src/server/scripts/Spells/spell_hunter.cpp +++ b/src/server/scripts/Spells/spell_hunter.cpp @@ -78,7 +78,8 @@ enum HunterSpells SPELL_HUNTER_RAPID_RECUPERATION_MANA_R1 = 56654, SPELL_HUNTER_RAPID_RECUPERATION_MANA_R2 = 58882, SPELL_HUNTER_PIERCING_SHOTS = 63468, - SPELL_HUNTER_T9_4P_GREATNESS = 68130 + SPELL_HUNTER_T9_4P_GREATNESS = 68130, + SPELL_HUNTER_COBRA_STRIKES_TRIGGERED = 53257 }; enum HunterSpellIcons @@ -934,6 +935,49 @@ class spell_hun_misdirection_proc : public AuraScript } }; +// -53256 - Cobra Strikes (talent) +class spell_hun_cobra_strikes : public AuraScript +{ + PrepareAuraScript(spell_hun_cobra_strikes); + + bool Validate(SpellInfo const* spellInfo) override + { + return ValidateSpellInfo({ spellInfo->Effects[EFFECT_0].TriggerSpell }); + } + + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& /*eventInfo*/) + { + PreventDefaultAction(); + + SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell); + if (!triggeredSpellInfo) + return; + + GetTarget()->CastCustomSpell(triggeredSpellInfo->Id, SPELLVALUE_AURA_STACK, triggeredSpellInfo->StackAmount, GetTarget(), true); + } + + void Register() override + { + OnEffectProc += AuraEffectProcFn(spell_hun_cobra_strikes::HandleProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL); + } +}; + +// 53257 - Cobra Strikes (triggered buff) +class spell_hun_cobra_strikes_triggered : public AuraScript +{ + PrepareAuraScript(spell_hun_cobra_strikes_triggered); + + void HandleStackDrop(AuraEffect const* /*aurEff*/, ProcEventInfo& /*eventInfo*/) + { + ModStackAmount(-1); + } + + void Register() override + { + OnEffectProc += AuraEffectProcFn(spell_hun_cobra_strikes_triggered::HandleStackDrop, EFFECT_0, SPELL_AURA_ADD_FLAT_MODIFIER); + } +}; + // 781 - Disengage class spell_hun_disengage : public SpellScript { @@ -1633,6 +1677,8 @@ void AddSC_hunter_spell_scripts() RegisterSpellScript(spell_hun_aspect_of_the_beast); RegisterSpellScript(spell_hun_ascpect_of_the_viper); RegisterSpellScript(spell_hun_chimera_shot); + RegisterSpellScript(spell_hun_cobra_strikes); + RegisterSpellScript(spell_hun_cobra_strikes_triggered); RegisterSpellScript(spell_hun_disengage); RegisterSpellScript(spell_hun_improved_mend_pet); RegisterSpellScript(spell_hun_invigoration);