diff options
-rw-r--r-- | sql/updates/world/cata_classic/2024_09_21_01_world.sql | 9 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_mage.cpp | 60 |
2 files changed, 69 insertions, 0 deletions
diff --git a/sql/updates/world/cata_classic/2024_09_21_01_world.sql b/sql/updates/world/cata_classic/2024_09_21_01_world.sql new file mode 100644 index 00000000000..067ef98ba22 --- /dev/null +++ b/sql/updates/world/cata_classic/2024_09_21_01_world.sql @@ -0,0 +1,9 @@ +DELETE FROM `spell_script_names` WHERE `ScriptName` IN ('spell_mage_offensive_state_dnd', 'spell_mage_arcane_missiles'); +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(79684, 'spell_mage_offensive_state_dnd'), +(79683, 'spell_mage_arcane_missiles'); + +DELETE FROM `spell_proc` WHERE `SpellId` IN (79684, 79683); +INSERT INTO `spell_proc` (`SpellId`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellPhaseMask`, `Charges`) VALUES +(79684, 3, 0x0, 0x1, 0), +(79683, 3, 0x800, 0x1, 1); diff --git a/src/server/scripts/Spells/spell_mage.cpp b/src/server/scripts/Spells/spell_mage.cpp index 2d0a40cd7b2..f8ac3169e92 100644 --- a/src/server/scripts/Spells/spell_mage.cpp +++ b/src/server/scripts/Spells/spell_mage.cpp @@ -30,6 +30,12 @@ namespace Scripts::Spells::Mage { + enum MageSpells + { + SPELL_MAGE_ARCANE_MISSILES = 5143, + SPELL_MAGE_ARCANE_MISSILES_AURASTATE = 79808 + }; + // 71761 - Deep Freeze Immunity State class spell_mage_deep_freeze_immunity_state : public AuraScript { @@ -55,10 +61,64 @@ namespace Scripts::Spells::Mage DoCheckEffectProc += AuraCheckEffectProcFn(spell_mage_deep_freeze_immunity_state::CheckEffectProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL); } }; + + // 79684 - Offensive State (DND) + class spell_mage_offensive_state_dnd : public AuraScript + { + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_MAGE_ARCANE_MISSILES }); + } + + bool CheckEffectProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + { + // Only allow Arcane Missiles! to proc when the player has learned the according spell + if (!GetTarget()->HasSpell(SPELL_MAGE_ARCANE_MISSILES)) + return false; + + // Arcane Missiles cannot trigger itself + if ((eventInfo.GetSpellInfo()->SpellFamilyFlags[0] & (0x800 | 0x200000)) != 0) + return false; + + return roll_chance_i(aurEff->GetAmount()); + } + + void Register() override + { + DoCheckEffectProc += AuraCheckEffectProcFn(spell_mage_offensive_state_dnd::CheckEffectProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL); + } + }; + + // 79683 - Arcane Missiles! + class spell_mage_arcane_missiles : public AuraScript + { + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_MAGE_ARCANE_MISSILES_AURASTATE }); + } + + void AfterApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + { + GetTarget()->CastSpell(nullptr, SPELL_MAGE_ARCANE_MISSILES_AURASTATE, aurEff); + } + + void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + GetTarget()->RemoveAurasDueToSpell(SPELL_MAGE_ARCANE_MISSILES_AURASTATE, GetCasterGUID()); + } + + void Register() override + { + AfterEffectApply += AuraEffectApplyFn(spell_mage_arcane_missiles::AfterApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + AfterEffectRemove += AuraEffectApplyFn(spell_mage_arcane_missiles::AfterRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + } + }; } void AddSC_mage_spell_scripts() { using namespace Scripts::Spells::Mage; RegisterSpellScript(spell_mage_deep_freeze_immunity_state); + RegisterSpellScript(spell_mage_offensive_state_dnd); + RegisterSpellScript(spell_mage_arcane_missiles); } |