fix(Core/Spells): Fix proc phase ordering CAST before HIT for instant spells (#24942)

Co-authored-by: blinkysc <blinkysc@users.noreply.github.com>
Co-authored-by: Shauren <297439+Shauren@users.noreply.github.com>
This commit is contained in:
blinkysc
2026-02-28 15:27:05 -06:00
committed by GitHub
parent 92f12f3bce
commit eae14a58b3
4 changed files with 351 additions and 22 deletions

View File

@@ -3956,6 +3956,44 @@ void Spell::_cast(bool skipCheck)
}
else
{
// CAST phase procs for non-channeled immediate spells
// (channeled spells handle this below to preserve spell mods)
// Note: triggered spells are allowed here; per-aura filtering via
// PROC_ATTR_TRIGGERED_CAN_PROC in SpellAuras.cpp handles rejection.
if (!m_spellInfo->IsChanneled() && m_originalCaster)
{
uint32 procAttacker = m_procAttacker;
if (!procAttacker)
{
bool IsPositive = m_spellInfo->IsPositive();
if (m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MAGIC)
{
procAttacker = IsPositive ? PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS : PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_NEG;
}
else
{
procAttacker = IsPositive ? PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_POS : PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_NEG;
}
}
uint32 hitMask = PROC_HIT_NORMAL;
for (std::list<TargetInfo>::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
{
if (ihit->missCondition != SPELL_MISS_NONE)
continue;
if (!ihit->crit)
continue;
hitMask |= PROC_HIT_CRITICAL;
break;
}
Unit::ProcSkillsAndAuras(m_originalCaster, m_originalCaster, procAttacker, PROC_FLAG_NONE, hitMask, 1, BASE_ATTACK, m_spellInfo, m_triggeredByAuraSpell.spellInfo,
m_triggeredByAuraSpell.effectIndex, this, nullptr, nullptr, PROC_SPELL_PHASE_CAST);
}
// Immediate spell, no big deal
handle_immediate();
}
@@ -3985,13 +4023,11 @@ void Spell::_cast(bool skipCheck)
if (modOwner)
modOwner->SetSpellModTakingSpell(this, false);
// Handle procs on cast - only for non-triggered spells
// Triggered spells (from auras, items, etc.) should not fire CAST phase procs
// as they are not player-initiated casts. This prevents issues like Arcane Potency
// charges being consumed by periodic damage effects (e.g., Blizzard ticks).
// Must be called AFTER handle_immediate() so spell mods (like Missile Barrage's
// duration reduction) are applied before the aura is consumed by the proc.
if (m_originalCaster && !IsTriggered())
// CAST phase procs for delayed and channeled spells
// Note: triggered spells are allowed here; per-aura filtering via
// PROC_ATTR_TRIGGERED_CAN_PROC in SpellAuras.cpp handles rejection.
if ((m_spellState == SPELL_STATE_DELAYED || m_spellInfo->IsChanneled())
&& m_originalCaster)
{
uint32 procAttacker = m_procAttacker;
if (!procAttacker)

View File

@@ -958,23 +958,11 @@ class spell_mage_fingers_of_frost : public AuraScript
void PrepareProc(ProcEventInfo& eventInfo)
{
// Block channeled spells (e.g. Blizzard channel start) from consuming charges.
// All other filtering is handled by SpellPhaseMask=1 (CAST only) in spell_proc.
if (Spell const* spell = eventInfo.GetProcSpell())
{
bool isTriggered = spell->IsTriggered();
bool isCastPhase = (eventInfo.GetSpellPhaseMask() & PROC_SPELL_PHASE_CAST) != 0;
bool isChanneled = spell->GetSpellInfo()->IsChanneled();
bool prevent = false;
if (isTriggered)
prevent = false;
else if (isChanneled)
prevent = true;
else if (!isCastPhase)
prevent = true;
if (prevent)
if (spell->GetSpellInfo()->IsChanneled())
PreventDefaultAction();
}
}
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)