fix(Core/Spells): Fix Cobra Strikes stack consumption (#24906)

Co-authored-by: blinkysc <blinkysc@users.noreply.github.com>
Co-authored-by: TrinityCore <TrinityCore@users.noreply.github.com>
This commit is contained in:
blinkysc
2026-02-27 08:42:17 -06:00
committed by GitHub
parent 74dd60a7b1
commit 396c35be2f
5 changed files with 72 additions and 11 deletions

View File

@@ -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');

View File

@@ -13040,6 +13040,23 @@ void Unit::TriggerAurasProcOnEvent(std::list<AuraApplication*>* 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<AuraApplication*> 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;

View File

@@ -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

View File

@@ -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)

View File

@@ -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);