diff --git a/data/sql/updates/pending_db_world/rev_1772406444785733446.sql b/data/sql/updates/pending_db_world/rev_1772406444785733446.sql new file mode 100644 index 000000000..ca27fc1cf --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1772406444785733446.sql @@ -0,0 +1,9 @@ +-- Fix Missile Barrage / Clearcasting proc interaction with Arcane Missiles +-- 1) PROC_ATTR_REQ_SPELLMOD was incorrectly blocking Missile Barrage from +-- proccing because the channel spell (42846) is not in m_appliedMods. +-- Restrict via SpellFamilyMask to Arcane Missiles (0x800) instead. +-- 2) Register Clearcasting script to give Missile Barrage priority +UPDATE `spell_proc` SET `AttributesMask` = 0, `SpellFamilyMask0` = 0x800 WHERE `SpellId` = 44401; + +DELETE FROM `spell_script_names` WHERE `spell_id` = 12536 AND `ScriptName` = 'spell_mage_clearcasting'; +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES (12536, 'spell_mage_clearcasting'); diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 882166c96..825312216 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -10027,9 +10027,10 @@ bool Player::HasSpellModApplied(SpellModifier* mod, Spell* spell) void Player::SetSpellModTakingSpell(Spell* spell, bool apply) { - if (apply && m_spellModTakingSpell && m_spellModTakingSpell != spell) + if (apply && m_spellModTakingSpell != nullptr) return; - else if (!apply && m_spellModTakingSpell != spell) + + if (!apply && (!m_spellModTakingSpell || m_spellModTakingSpell != spell)) return; m_spellModTakingSpell = apply ? spell : nullptr; diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index f0dc74a0e..cc8c0750c 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -3911,9 +3911,6 @@ void Spell::_cast(bool skipCheck) // we must send smsg_spell_go packet before m_castItem delete in TakeCastItem()... SendSpellGo(); - if (modOwner) - modOwner->SetSpellModTakingSpell(this, true); - bool resetAttackTimers = IsAutoActionResetSpell() && !m_spellInfo->HasAttribute(SPELL_ATTR2_DO_NOT_RESET_COMBAT_TIMERS); if (resetAttackTimers) { diff --git a/src/server/scripts/Spells/spell_mage.cpp b/src/server/scripts/Spells/spell_mage.cpp index c4b6865c3..90dfd1064 100644 --- a/src/server/scripts/Spells/spell_mage.cpp +++ b/src/server/scripts/Spells/spell_mage.cpp @@ -71,7 +71,8 @@ enum MageSpells SPELL_MAGE_CHILLED_R3 = 12486, SPELL_MAGE_MANA_SURGE = 37445, SPELL_MAGE_FROST_NOVA = 122, - SPELL_MAGE_LIVING_BOMB_R1 = 44457 + SPELL_MAGE_LIVING_BOMB_R1 = 44457, + SPELL_MAGE_MISSILE_BARRAGE_PROC = 44401 }; enum MageSpellIcons @@ -1504,6 +1505,31 @@ class spell_mage_ice_block : public SpellScript } }; +// 12536 - Clearcasting +class spell_mage_clearcasting : public AuraScript +{ + PrepareAuraScript(spell_mage_clearcasting); + + bool CheckProc(ProcEventInfo& eventInfo) + { + SpellInfo const* spellInfo = eventInfo.GetSpellInfo(); + if (!spellInfo) + return true; + + // Missile Barrage has priority over Clearcasting for Arcane Missiles + if (spellInfo->SpellFamilyName == SPELLFAMILY_MAGE && (spellInfo->SpellFamilyFlags[0] & 0x800)) + if (GetTarget()->HasAura(SPELL_MAGE_MISSILE_BARRAGE_PROC)) + return false; + + return true; + } + + void Register() override + { + DoCheckProc += AuraCheckProcFn(spell_mage_clearcasting::CheckProc); + } +}; + // 44401 - Missile Barrage (proc buff) class spell_mage_missile_barrage_proc : public AuraScript { @@ -1575,6 +1601,7 @@ void AddSC_mage_spell_scripts() RegisterSpellScript(spell_mage_ice_block); RegisterSpellScript(spell_mage_imp_blizzard); RegisterSpellScript(spell_mage_imp_mana_gems); + RegisterSpellScript(spell_mage_clearcasting); RegisterSpellScript(spell_mage_missile_barrage); RegisterSpellScript(spell_mage_missile_barrage_proc); RegisterSpellScript(spell_mage_blast_wave);