From ef0bbc4c7be9c4c76385e47d8aec7c917e3bb99e Mon Sep 17 00:00:00 2001 From: Kitzunu <24550914+Kitzunu@users.noreply.github.com> Date: Tue, 9 Nov 2021 11:44:37 +0100 Subject: [PATCH] refactor(Scripts/Spells): convert spell_mage into new system (#9058) --- .../rev_1636371600934152600.sql | 5 + src/server/scripts/Spells/spell_mage.cpp | 1445 +++++++---------- 2 files changed, 611 insertions(+), 839 deletions(-) create mode 100644 data/sql/updates/pending_db_world/rev_1636371600934152600.sql diff --git a/data/sql/updates/pending_db_world/rev_1636371600934152600.sql b/data/sql/updates/pending_db_world/rev_1636371600934152600.sql new file mode 100644 index 000000000..b9811a79f --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1636371600934152600.sql @@ -0,0 +1,5 @@ +INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1636371600934152600'); + +DELETE FROM `spell_script_names` WHERE `ScriptName` = 'spell_mage_polymorph_visual'; +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(32826,'spell_mage_polymorph_cast_visual'); diff --git a/src/server/scripts/Spells/spell_mage.cpp b/src/server/scripts/Spells/spell_mage.cpp index ad81ab742..40f9e3994 100644 --- a/src/server/scripts/Spells/spell_mage.cpp +++ b/src/server/scripts/Spells/spell_mage.cpp @@ -57,463 +57,347 @@ enum MageSpells SPELL_MAGE_GLYPH_OF_BLAST_WAVE = 62126, }; -// Ours -class spell_mage_arcane_blast : public SpellScriptLoader +class spell_mage_arcane_blast : public SpellScript { -public: - spell_mage_arcane_blast() : SpellScriptLoader("spell_mage_arcane_blast") { } + PrepareSpellScript(spell_mage_arcane_blast); - class spell_mage_arcane_blast_SpellScript : public SpellScript + bool Load() override { _triggerSpellId = 0; return true; } + + void HandleTriggerSpell(SpellEffIndex effIndex) { - PrepareSpellScript(spell_mage_arcane_blast_SpellScript); + _triggerSpellId = GetSpellInfo()->Effects[effIndex].TriggerSpell; + PreventHitDefaultEffect(effIndex); + } - bool Load() override { _triggerSpellId = 0; return true; } - - void HandleTriggerSpell(SpellEffIndex effIndex) - { - _triggerSpellId = GetSpellInfo()->Effects[effIndex].TriggerSpell; - PreventHitDefaultEffect(effIndex); - } - - void HandleAfterCast() - { - GetCaster()->CastSpell(GetCaster(), _triggerSpellId, TRIGGERED_FULL_MASK); - } - - void Register() override - { - OnEffectLaunch += SpellEffectFn(spell_mage_arcane_blast_SpellScript::HandleTriggerSpell, EFFECT_1, SPELL_EFFECT_TRIGGER_SPELL); - OnEffectLaunchTarget += SpellEffectFn(spell_mage_arcane_blast_SpellScript::HandleTriggerSpell, EFFECT_1, SPELL_EFFECT_TRIGGER_SPELL); - AfterCast += SpellCastFn(spell_mage_arcane_blast_SpellScript::HandleAfterCast); - } - - private: - uint32 _triggerSpellId; - }; - - SpellScript* GetSpellScript() const override + void HandleAfterCast() { - return new spell_mage_arcane_blast_SpellScript(); + GetCaster()->CastSpell(GetCaster(), _triggerSpellId, TRIGGERED_FULL_MASK); + } + + void Register() override + { + OnEffectLaunch += SpellEffectFn(spell_mage_arcane_blast::HandleTriggerSpell, EFFECT_1, SPELL_EFFECT_TRIGGER_SPELL); + OnEffectLaunchTarget += SpellEffectFn(spell_mage_arcane_blast::HandleTriggerSpell, EFFECT_1, SPELL_EFFECT_TRIGGER_SPELL); + AfterCast += SpellCastFn(spell_mage_arcane_blast::HandleAfterCast); + } + +private: + uint32 _triggerSpellId; +}; + +class spell_mage_deep_freeze : public SpellScript +{ + PrepareSpellScript(spell_mage_deep_freeze) + + void HandleOnHit() + { + if (Unit* caster = GetCaster()) + if (Unit* target = (caster->ToPlayer() ? caster->ToPlayer()->GetSelectedUnit() : nullptr)) + if (Creature* cTarget = target->ToCreature()) + if (cTarget->HasMechanicTemplateImmunity(1 << (MECHANIC_STUN - 1))) + caster->CastSpell(cTarget, 71757, true); + } + + void Register() override + { + OnHit += SpellHitFn(spell_mage_deep_freeze::HandleOnHit); } }; -class spell_mage_deep_freeze : public SpellScriptLoader +class spell_mage_burning_determination : public AuraScript { -public: - spell_mage_deep_freeze() : SpellScriptLoader("spell_mage_deep_freeze") { } + PrepareAuraScript(spell_mage_burning_determination); - class spell_mage_deep_freeze_SpellScript : public SpellScript + bool CheckProc(ProcEventInfo& eventInfo) { - PrepareSpellScript(spell_mage_deep_freeze_SpellScript) + if (!eventInfo.GetSpellInfo() || !eventInfo.GetActionTarget()) + return false; - void HandleOnHit() + // Need Interrupt or Silenced mechanic + if (!(eventInfo.GetSpellInfo()->GetAllEffectsMechanicMask() & ((1 << MECHANIC_INTERRUPT) | (1 << MECHANIC_SILENCE)))) + return false; + + // Xinef: immuned effect should just eat charge + if (eventInfo.GetHitMask() & PROC_EX_IMMUNE) { - if (Unit* caster = GetCaster()) - if (Unit* target = (caster->ToPlayer() ? caster->ToPlayer()->GetSelectedUnit() : nullptr)) - if (Creature* cTarget = target->ToCreature()) - if (cTarget->HasMechanicTemplateImmunity(1 << (MECHANIC_STUN - 1))) - caster->CastSpell(cTarget, 71757, true); + eventInfo.GetActionTarget()->RemoveAurasDueToSpell(54748); + return false; } - - void Register() override + if (Aura* aura = eventInfo.GetActionTarget()->GetAura(54748)) { - OnHit += SpellHitFn(spell_mage_deep_freeze_SpellScript::HandleOnHit); - } - }; - - SpellScript* GetSpellScript() const override - { - return new spell_mage_deep_freeze_SpellScript(); - } -}; - -class spell_mage_burning_determination : public SpellScriptLoader -{ -public: - spell_mage_burning_determination() : SpellScriptLoader("spell_mage_burning_determination") { } - - class spell_mage_burning_determination_AuraScript : public AuraScript - { - PrepareAuraScript(spell_mage_burning_determination_AuraScript); - - bool CheckProc(ProcEventInfo& eventInfo) - { - if (!eventInfo.GetSpellInfo() || !eventInfo.GetActionTarget()) - return false; - - // Need Interrupt or Silenced mechanic - if (!(eventInfo.GetSpellInfo()->GetAllEffectsMechanicMask() & ((1 << MECHANIC_INTERRUPT) | (1 << MECHANIC_SILENCE)))) - return false; - - // Xinef: immuned effect should just eat charge - if (eventInfo.GetHitMask() & PROC_EX_IMMUNE) - { + if (aura->GetDuration() < aura->GetMaxDuration()) eventInfo.GetActionTarget()->RemoveAurasDueToSpell(54748); - return false; - } - if (Aura* aura = eventInfo.GetActionTarget()->GetAura(54748)) - { - if (aura->GetDuration() < aura->GetMaxDuration()) - eventInfo.GetActionTarget()->RemoveAurasDueToSpell(54748); - return false; - } - - return true; - } - - void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& /*eventInfo*/) - { - PreventDefaultAction(); - GetUnitOwner()->CastSpell(GetUnitOwner(), 54748, true); - } - - void Register() override - { - DoCheckProc += AuraCheckProcFn(spell_mage_burning_determination_AuraScript::CheckProc); - OnEffectProc += AuraEffectProcFn(spell_mage_burning_determination_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL); - } - }; - - AuraScript* GetAuraScript() const override - { - return new spell_mage_burning_determination_AuraScript(); - } -}; - -class spell_mage_molten_armor : public SpellScriptLoader -{ -public: - spell_mage_molten_armor() : SpellScriptLoader("spell_mage_molten_armor") { } - - class spell_mage_molten_armor_AuraScript : public AuraScript - { - PrepareAuraScript(spell_mage_molten_armor_AuraScript); - - bool CheckProc(ProcEventInfo& eventInfo) - { - const SpellInfo* spellInfo = eventInfo.GetSpellInfo(); - if (!spellInfo || (eventInfo.GetTypeMask() & PROC_FLAG_TAKEN_MELEE_AUTO_ATTACK)) - return true; - - // Xinef: Molten Shields talent - if (AuraEffect* aurEff = eventInfo.GetActionTarget()->GetAuraEffect(SPELL_AURA_ADD_FLAT_MODIFIER, SPELLFAMILY_MAGE, 16, EFFECT_0)) - return roll_chance_i(aurEff->GetSpellInfo()->GetRank() * 50); - return false; } - void Register() override - { - DoCheckProc += AuraCheckProcFn(spell_mage_molten_armor_AuraScript::CheckProc); - } - }; + return true; + } - AuraScript* GetAuraScript() const override + void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& /*eventInfo*/) { - return new spell_mage_molten_armor_AuraScript(); + PreventDefaultAction(); + GetUnitOwner()->CastSpell(GetUnitOwner(), 54748, true); + } + + void Register() override + { + DoCheckProc += AuraCheckProcFn(spell_mage_burning_determination::CheckProc); + OnEffectProc += AuraEffectProcFn(spell_mage_burning_determination::HandleProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL); } }; -class spell_mage_mirror_image : public SpellScriptLoader +class spell_mage_molten_armor : public AuraScript { -public: - spell_mage_mirror_image() : SpellScriptLoader("spell_mage_mirror_image") { } + PrepareAuraScript(spell_mage_molten_armor); - class spell_mage_mirror_image_AuraScript : public AuraScript + bool CheckProc(ProcEventInfo& eventInfo) { - PrepareAuraScript(spell_mage_mirror_image_AuraScript) + const SpellInfo* spellInfo = eventInfo.GetSpellInfo(); + if (!spellInfo || (eventInfo.GetTypeMask() & PROC_FLAG_TAKEN_MELEE_AUTO_ATTACK)) + return true; - void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) - { - GetTarget()->CastSpell((Unit*)nullptr, GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, true); - } + // Xinef: Molten Shields talent + if (AuraEffect* aurEff = eventInfo.GetActionTarget()->GetAuraEffect(SPELL_AURA_ADD_FLAT_MODIFIER, SPELLFAMILY_MAGE, 16, EFFECT_0)) + return roll_chance_i(aurEff->GetSpellInfo()->GetRank() * 50); - void CalcPeriodic(AuraEffect const* /*effect*/, bool& isPeriodic, int32& /*amplitude*/) - { - isPeriodic = false; - } + return false; + } - void Register() override - { - OnEffectApply += AuraEffectApplyFn(spell_mage_mirror_image_AuraScript::HandleEffectApply, EFFECT_2, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL); - DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_mage_mirror_image_AuraScript::CalcPeriodic, EFFECT_2, SPELL_AURA_PERIODIC_DUMMY); - } - }; - - AuraScript* GetAuraScript() const override + void Register() override { - return new spell_mage_mirror_image_AuraScript(); + DoCheckProc += AuraCheckProcFn(spell_mage_molten_armor::CheckProc); } }; -class spell_mage_burnout : public SpellScriptLoader +class spell_mage_mirror_image : public AuraScript { -public: - spell_mage_burnout() : SpellScriptLoader("spell_mage_burnout") { } + PrepareAuraScript(spell_mage_mirror_image) - class spell_mage_burnout_AuraScript : public AuraScript + void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) { - PrepareAuraScript(spell_mage_burnout_AuraScript); + GetTarget()->CastSpell((Unit*)nullptr, GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, true); + } - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo({ SPELL_MAGE_BURNOUT_TRIGGER }); - } - - bool CheckProc(ProcEventInfo& eventInfo) - { - return eventInfo.GetSpellInfo() != nullptr; - } - - void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) - { - PreventDefaultAction(); - - int32 mana = int32(eventInfo.GetSpellInfo()->CalcPowerCost(GetTarget(), eventInfo.GetSchoolMask())); - mana = CalculatePct(mana, aurEff->GetAmount()); - - GetTarget()->CastCustomSpell(SPELL_MAGE_BURNOUT_TRIGGER, SPELLVALUE_BASE_POINT0, mana, GetTarget(), true, nullptr, aurEff); - } - - void Register() override - { - DoCheckProc += AuraCheckProcFn(spell_mage_burnout_AuraScript::CheckProc); - OnEffectProc += AuraEffectProcFn(spell_mage_burnout_AuraScript::HandleProc, EFFECT_1, SPELL_AURA_DUMMY); - } - }; - - AuraScript* GetAuraScript() const override + void CalcPeriodic(AuraEffect const* /*effect*/, bool& isPeriodic, int32& /*amplitude*/) { - return new spell_mage_burnout_AuraScript(); + isPeriodic = false; + } + + void Register() override + { + OnEffectApply += AuraEffectApplyFn(spell_mage_mirror_image::HandleEffectApply, EFFECT_2, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL); + DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_mage_mirror_image::CalcPeriodic, EFFECT_2, SPELL_AURA_PERIODIC_DUMMY); } }; -class spell_mage_burnout_trigger : public SpellScriptLoader +class spell_mage_burnout : public AuraScript { -public: - spell_mage_burnout_trigger() : SpellScriptLoader("spell_mage_burnout_trigger") { } + PrepareAuraScript(spell_mage_burnout); - class spell_mage_burnout_trigger_SpellScript : public SpellScript + bool Validate(SpellInfo const* /*spellInfo*/) override { - PrepareSpellScript(spell_mage_burnout_trigger_SpellScript); + return ValidateSpellInfo({ SPELL_MAGE_BURNOUT_TRIGGER }); + } - void HandleDummy(SpellEffIndex effIndex) - { - PreventHitDefaultEffect(effIndex); - if (Unit* target = GetHitUnit()) - { - int32 newDamage = -(target->ModifyPower(POWER_MANA, -GetEffectValue())); - GetSpell()->ExecuteLogEffectTakeTargetPower(effIndex, target, POWER_MANA, newDamage, 0.0f); - } - } - - void Register() override - { - OnEffectHitTarget += SpellEffectFn(spell_mage_burnout_trigger_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_POWER_BURN); - } - }; - - SpellScript* GetSpellScript() const override + bool CheckProc(ProcEventInfo& eventInfo) { - return new spell_mage_burnout_trigger_SpellScript(); + return eventInfo.GetSpellInfo() != nullptr; + } + + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + { + PreventDefaultAction(); + + int32 mana = int32(eventInfo.GetSpellInfo()->CalcPowerCost(GetTarget(), eventInfo.GetSchoolMask())); + mana = CalculatePct(mana, aurEff->GetAmount()); + + GetTarget()->CastCustomSpell(SPELL_MAGE_BURNOUT_TRIGGER, SPELLVALUE_BASE_POINT0, mana, GetTarget(), true, nullptr, aurEff); + } + + void Register() override + { + DoCheckProc += AuraCheckProcFn(spell_mage_burnout::CheckProc); + OnEffectProc += AuraEffectProcFn(spell_mage_burnout::HandleProc, EFFECT_1, SPELL_AURA_DUMMY); } }; -class spell_mage_pet_scaling : public SpellScriptLoader +class spell_mage_burnout_trigger : public SpellScript { -public: - spell_mage_pet_scaling() : SpellScriptLoader("spell_mage_pet_scaling") { } + PrepareSpellScript(spell_mage_burnout_trigger); - class spell_mage_pet_scaling_AuraScript : public AuraScript + void HandleDummy(SpellEffIndex effIndex) { - PrepareAuraScript(spell_mage_pet_scaling_AuraScript); - - void CalculateResistanceAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + PreventHitDefaultEffect(effIndex); + if (Unit* target = GetHitUnit()) { - // xinef: mage pet inherits 40% of resistance from owner and 35% of armor (guessed) - if (Unit* owner = GetUnitOwner()->GetOwner()) + int32 newDamage = -(target->ModifyPower(POWER_MANA, -GetEffectValue())); + GetSpell()->ExecuteLogEffectTakeTargetPower(effIndex, target, POWER_MANA, newDamage, 0.0f); + } + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_mage_burnout_trigger::HandleDummy, EFFECT_0, SPELL_EFFECT_POWER_BURN); + } +}; + +class spell_mage_pet_scaling : public AuraScript +{ + PrepareAuraScript(spell_mage_pet_scaling); + + void CalculateResistanceAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + { + // xinef: mage pet inherits 40% of resistance from owner and 35% of armor (guessed) + if (Unit* owner = GetUnitOwner()->GetOwner()) + { + SpellSchoolMask schoolMask = SpellSchoolMask(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue); + int32 modifier = schoolMask == SPELL_SCHOOL_MASK_NORMAL ? 35 : 40; + amount = CalculatePct(std::max(0, owner->GetResistance(schoolMask)), modifier); + } + } + + void CalculateStatAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + { + // xinef: mage pet inherits 30% of intellect / stamina + if (Unit* owner = GetUnitOwner()->GetOwner()) + { + Stats stat = Stats(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue); + amount = CalculatePct(std::max(0, owner->GetStat(stat)), 30); + } + } + + void CalculateAPAmount(AuraEffect const* /*aurEff*/, int32& /*amount*/, bool& /*canBeRecalculated*/) + { + // xinef: mage pet inherits 0% AP + } + + void CalculateSPAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + { + // xinef: mage pet inherits 33% of SP + if (Unit* owner = GetUnitOwner()->GetOwner()) + { + int32 frost = owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_FROST); + amount = CalculatePct(std::max(0, frost), 33); + + // xinef: Update appropriate player field + if (owner->GetTypeId() == TYPEID_PLAYER) + owner->SetUInt32Value(PLAYER_PET_SPELL_POWER, (uint32)amount); + } + } + + void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + { + if (GetUnitOwner()->IsPet()) + return; + + GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, aurEff->GetAuraType(), true, SPELL_BLOCK_TYPE_POSITIVE); + if (aurEff->GetAuraType() == SPELL_AURA_MOD_ATTACK_POWER) + GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_ATTACK_POWER_PCT, true, SPELL_BLOCK_TYPE_POSITIVE); + else if (aurEff->GetAuraType() == SPELL_AURA_MOD_STAT) + GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, true, SPELL_BLOCK_TYPE_POSITIVE); + } + + void CalcPeriodic(AuraEffect const* /*aurEff*/, bool& isPeriodic, int32& amplitude) + { + if (!GetUnitOwner()->IsPet()) + return; + + isPeriodic = true; + amplitude = 2 * IN_MILLISECONDS; + } + + void HandlePeriodic(AuraEffect const* aurEff) + { + PreventDefaultAction(); + if (aurEff->GetAuraType() == SPELL_AURA_MOD_STAT && (aurEff->GetMiscValue() == STAT_STAMINA || aurEff->GetMiscValue() == STAT_INTELLECT)) + { + int32 currentAmount = aurEff->GetAmount(); + int32 newAmount = GetEffect(aurEff->GetEffIndex())->CalculateAmount(GetCaster()); + if (newAmount != currentAmount) { - SpellSchoolMask schoolMask = SpellSchoolMask(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue); - int32 modifier = schoolMask == SPELL_SCHOOL_MASK_NORMAL ? 35 : 40; - amount = CalculatePct(std::max(0, owner->GetResistance(schoolMask)), modifier); - } - } - - void CalculateStatAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) - { - // xinef: mage pet inherits 30% of intellect / stamina - if (Unit* owner = GetUnitOwner()->GetOwner()) - { - Stats stat = Stats(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue); - amount = CalculatePct(std::max(0, owner->GetStat(stat)), 30); - } - } - - void CalculateAPAmount(AuraEffect const* /*aurEff*/, int32& /*amount*/, bool& /*canBeRecalculated*/) - { - // xinef: mage pet inherits 0% AP - } - - void CalculateSPAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) - { - // xinef: mage pet inherits 33% of SP - if (Unit* owner = GetUnitOwner()->GetOwner()) - { - int32 frost = owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_FROST); - amount = CalculatePct(std::max(0, frost), 33); - - // xinef: Update appropriate player field - if (owner->GetTypeId() == TYPEID_PLAYER) - owner->SetUInt32Value(PLAYER_PET_SPELL_POWER, (uint32)amount); - } - } - - void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) - { - if (GetUnitOwner()->IsPet()) - return; - - GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, aurEff->GetAuraType(), true, SPELL_BLOCK_TYPE_POSITIVE); - if (aurEff->GetAuraType() == SPELL_AURA_MOD_ATTACK_POWER) - GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_ATTACK_POWER_PCT, true, SPELL_BLOCK_TYPE_POSITIVE); - else if (aurEff->GetAuraType() == SPELL_AURA_MOD_STAT) - GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, true, SPELL_BLOCK_TYPE_POSITIVE); - } - - void CalcPeriodic(AuraEffect const* /*aurEff*/, bool& isPeriodic, int32& amplitude) - { - if (!GetUnitOwner()->IsPet()) - return; - - isPeriodic = true; - amplitude = 2 * IN_MILLISECONDS; - } - - void HandlePeriodic(AuraEffect const* aurEff) - { - PreventDefaultAction(); - if (aurEff->GetAuraType() == SPELL_AURA_MOD_STAT && (aurEff->GetMiscValue() == STAT_STAMINA || aurEff->GetMiscValue() == STAT_INTELLECT)) - { - int32 currentAmount = aurEff->GetAmount(); - int32 newAmount = GetEffect(aurEff->GetEffIndex())->CalculateAmount(GetCaster()); - if (newAmount != currentAmount) + if (aurEff->GetMiscValue() == STAT_STAMINA) { - if (aurEff->GetMiscValue() == STAT_STAMINA) - { - uint32 actStat = GetUnitOwner()->GetHealth(); - GetEffect(aurEff->GetEffIndex())->ChangeAmount(newAmount, false); - GetUnitOwner()->SetHealth(std::min(GetUnitOwner()->GetMaxHealth(), actStat)); - } - else - { - uint32 actStat = GetUnitOwner()->GetPower(POWER_MANA); - GetEffect(aurEff->GetEffIndex())->ChangeAmount(newAmount, false); - GetUnitOwner()->SetPower(POWER_MANA, std::min(GetUnitOwner()->GetMaxPower(POWER_MANA), actStat)); - } + uint32 actStat = GetUnitOwner()->GetHealth(); + GetEffect(aurEff->GetEffIndex())->ChangeAmount(newAmount, false); + GetUnitOwner()->SetHealth(std::min(GetUnitOwner()->GetMaxHealth(), actStat)); + } + else + { + uint32 actStat = GetUnitOwner()->GetPower(POWER_MANA); + GetEffect(aurEff->GetEffIndex())->ChangeAmount(newAmount, false); + GetUnitOwner()->SetPower(POWER_MANA, std::min(GetUnitOwner()->GetMaxPower(POWER_MANA), actStat)); } } - else - GetEffect(aurEff->GetEffIndex())->RecalculateAmount(); } + else + GetEffect(aurEff->GetEffIndex())->RecalculateAmount(); + } - void Register() override - { - if (m_scriptSpellId != 35657) - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_mage_pet_scaling_AuraScript::CalculateResistanceAmount, EFFECT_ALL, SPELL_AURA_MOD_RESISTANCE); - - if (m_scriptSpellId == 35657 || m_scriptSpellId == 35658) - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_mage_pet_scaling_AuraScript::CalculateStatAmount, EFFECT_ALL, SPELL_AURA_MOD_STAT); - - if (m_scriptSpellId == 35657) - { - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_mage_pet_scaling_AuraScript::CalculateAPAmount, EFFECT_ALL, SPELL_AURA_MOD_ATTACK_POWER); - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_mage_pet_scaling_AuraScript::CalculateSPAmount, EFFECT_ALL, SPELL_AURA_MOD_DAMAGE_DONE); - } - - OnEffectApply += AuraEffectApplyFn(spell_mage_pet_scaling_AuraScript::HandleEffectApply, EFFECT_ALL, SPELL_AURA_ANY, AURA_EFFECT_HANDLE_REAL); - DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_mage_pet_scaling_AuraScript::CalcPeriodic, EFFECT_ALL, SPELL_AURA_ANY); - OnEffectPeriodic += AuraEffectPeriodicFn(spell_mage_pet_scaling_AuraScript::HandlePeriodic, EFFECT_ALL, SPELL_AURA_ANY); - } - }; - - AuraScript* GetAuraScript() const override + void Register() override { - return new spell_mage_pet_scaling_AuraScript(); + if (m_scriptSpellId != 35657) + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_mage_pet_scaling::CalculateResistanceAmount, EFFECT_ALL, SPELL_AURA_MOD_RESISTANCE); + + if (m_scriptSpellId == 35657 || m_scriptSpellId == 35658) + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_mage_pet_scaling::CalculateStatAmount, EFFECT_ALL, SPELL_AURA_MOD_STAT); + + if (m_scriptSpellId == 35657) + { + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_mage_pet_scaling::CalculateAPAmount, EFFECT_ALL, SPELL_AURA_MOD_ATTACK_POWER); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_mage_pet_scaling::CalculateSPAmount, EFFECT_ALL, SPELL_AURA_MOD_DAMAGE_DONE); + } + + OnEffectApply += AuraEffectApplyFn(spell_mage_pet_scaling::HandleEffectApply, EFFECT_ALL, SPELL_AURA_ANY, AURA_EFFECT_HANDLE_REAL); + DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_mage_pet_scaling::CalcPeriodic, EFFECT_ALL, SPELL_AURA_ANY); + OnEffectPeriodic += AuraEffectPeriodicFn(spell_mage_pet_scaling::HandlePeriodic, EFFECT_ALL, SPELL_AURA_ANY); } }; -class spell_mage_brain_freeze : public SpellScriptLoader +class spell_mage_brain_freeze : public AuraScript { -public: - spell_mage_brain_freeze() : SpellScriptLoader("spell_mage_brain_freeze") { } + PrepareAuraScript(spell_mage_brain_freeze); - class spell_mage_brain_freeze_AuraScript : public AuraScript + bool CheckProc(ProcEventInfo& eventInfo) { - PrepareAuraScript(spell_mage_brain_freeze_AuraScript); + const SpellInfo* spellInfo = eventInfo.GetSpellInfo(); + if (!spellInfo) + return false; - bool CheckProc(ProcEventInfo& eventInfo) - { - const SpellInfo* spellInfo = eventInfo.GetSpellInfo(); - if (!spellInfo) - return false; + // xinef: Improved Blizzard, generic chilled check + if (spellInfo->SpellFamilyFlags[0] & 0x100000) + return spellInfo->Id == SPELL_MAGE_IMPROVED_BLIZZARD_CHILLED; - // xinef: Improved Blizzard, generic chilled check - if (spellInfo->SpellFamilyFlags[0] & 0x100000) - return spellInfo->Id == SPELL_MAGE_IMPROVED_BLIZZARD_CHILLED; + return true; + } - return true; - } - - void Register() override - { - DoCheckProc += AuraCheckProcFn(spell_mage_brain_freeze_AuraScript::CheckProc); - } - }; - - AuraScript* GetAuraScript() const override + void Register() override { - return new spell_mage_brain_freeze_AuraScript(); + DoCheckProc += AuraCheckProcFn(spell_mage_brain_freeze::CheckProc); } }; -class spell_mage_glyph_of_eternal_water : public SpellScriptLoader +class spell_mage_glyph_of_eternal_water : public AuraScript { -public: - spell_mage_glyph_of_eternal_water() : SpellScriptLoader("spell_mage_glyph_of_eternal_water") { } + PrepareAuraScript(spell_mage_glyph_of_eternal_water); - class spell_mage_glyph_of_eternal_water_AuraScript : public AuraScript + void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - PrepareAuraScript(spell_mage_glyph_of_eternal_water_AuraScript); + if (Unit* target = GetTarget()) + if (Player* player = target->ToPlayer()) + if (Pet* pet = player->GetPet()) + if (pet->GetEntry() == NPC_WATER_ELEMENTAL_PERM) + pet->Remove(PET_SAVE_NOT_IN_SLOT); + } - void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - if (Unit* target = GetTarget()) - if (Player* player = target->ToPlayer()) - if (Pet* pet = player->GetPet()) - if (pet->GetEntry() == NPC_WATER_ELEMENTAL_PERM) - pet->Remove(PET_SAVE_NOT_IN_SLOT); - } - - void Register() override - { - OnEffectRemove += AuraEffectRemoveFn(spell_mage_glyph_of_eternal_water_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); - } - }; - - AuraScript* GetAuraScript() const override + void Register() override { - return new spell_mage_glyph_of_eternal_water_AuraScript(); + OnEffectRemove += AuraEffectRemoveFn(spell_mage_glyph_of_eternal_water::OnRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); } }; -class spell_mage_combustion_proc : public SpellScriptLoader -{ -public: - spell_mage_combustion_proc() : SpellScriptLoader("spell_mage_combustion_proc") {} - - class spell_mage_combustion_proc_AuraScript : public AuraScript + class spell_mage_combustion_proc : public AuraScript { - PrepareAuraScript(spell_mage_combustion_proc_AuraScript); + PrepareAuraScript(spell_mage_combustion_proc); bool Validate(SpellInfo const* /*spellInfo*/) override { @@ -527,17 +411,10 @@ public: void Register() override { - AfterEffectRemove += AuraEffectRemoveFn(spell_mage_combustion_proc_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_ADD_FLAT_MODIFIER, AURA_EFFECT_HANDLE_REAL); + AfterEffectRemove += AuraEffectRemoveFn(spell_mage_combustion_proc::OnRemove, EFFECT_0, SPELL_AURA_ADD_FLAT_MODIFIER, AURA_EFFECT_HANDLE_REAL); } }; - AuraScript* GetAuraScript() const override - { - return new spell_mage_combustion_proc_AuraScript(); - } -}; - -// Theirs // Incanter's Absorbtion class spell_mage_incanters_absorbtion_base_AuraScript : public AuraScript { @@ -567,211 +444,167 @@ public: }; // -11113 - Blast Wave -class spell_mage_blast_wave : public SpellScriptLoader +class spell_mage_blast_wave : public SpellScript { -public: - spell_mage_blast_wave() : SpellScriptLoader("spell_mage_blast_wave") { } + PrepareSpellScript(spell_mage_blast_wave); - class spell_mage_blast_wave_SpellScript : public SpellScript + bool Validate(SpellInfo const* /*spellInfo*/) override { - PrepareSpellScript(spell_mage_blast_wave_SpellScript); + return ValidateSpellInfo({ SPELL_MAGE_GLYPH_OF_BLAST_WAVE }); + } - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo({ SPELL_MAGE_GLYPH_OF_BLAST_WAVE }); - } - - void HandleKnockBack(SpellEffIndex effIndex) - { - if (GetCaster()->HasAura(SPELL_MAGE_GLYPH_OF_BLAST_WAVE)) - PreventHitDefaultEffect(effIndex); - } - - void Register() override - { - OnEffectHitTarget += SpellEffectFn(spell_mage_blast_wave_SpellScript::HandleKnockBack, EFFECT_2, SPELL_EFFECT_KNOCK_BACK); - } - }; - - SpellScript* GetSpellScript() const override + void HandleKnockBack(SpellEffIndex effIndex) { - return new spell_mage_blast_wave_SpellScript(); + if (GetCaster()->HasAura(SPELL_MAGE_GLYPH_OF_BLAST_WAVE)) + PreventHitDefaultEffect(effIndex); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_mage_blast_wave::HandleKnockBack, EFFECT_2, SPELL_EFFECT_KNOCK_BACK); } }; // 11958 - Cold Snap -class spell_mage_cold_snap : public SpellScriptLoader +class spell_mage_cold_snap : public SpellScript { -public: - spell_mage_cold_snap() : SpellScriptLoader("spell_mage_cold_snap") { } + PrepareSpellScript(spell_mage_cold_snap); - class spell_mage_cold_snap_SpellScript : public SpellScript + bool Load() override { - PrepareSpellScript(spell_mage_cold_snap_SpellScript); + return GetCaster()->GetTypeId() == TYPEID_PLAYER; + } - bool Load() override + void HandleDummy(SpellEffIndex /*effIndex*/) + { + Player* caster = GetCaster()->ToPlayer(); + // immediately finishes the cooldown on Frost spells + + PlayerSpellMap const& spellMap = caster->GetSpellMap(); + for (PlayerSpellMap::const_iterator itr = spellMap.begin(); itr != spellMap.end(); ++itr) { - return GetCaster()->GetTypeId() == TYPEID_PLAYER; - } - - void HandleDummy(SpellEffIndex /*effIndex*/) - { - Player* caster = GetCaster()->ToPlayer(); - // immediately finishes the cooldown on Frost spells - - PlayerSpellMap const& spellMap = caster->GetSpellMap(); - for (PlayerSpellMap::const_iterator itr = spellMap.begin(); itr != spellMap.end(); ++itr) + SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(itr->first); + if (spellInfo->SpellFamilyName == SPELLFAMILY_MAGE && (spellInfo->GetSchoolMask() & SPELL_SCHOOL_MASK_FROST) && spellInfo->Id != SPELL_MAGE_COLD_SNAP && spellInfo->GetRecoveryTime() > 0) { - SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(itr->first); - if (spellInfo->SpellFamilyName == SPELLFAMILY_MAGE && (spellInfo->GetSchoolMask() & SPELL_SCHOOL_MASK_FROST) && spellInfo->Id != SPELL_MAGE_COLD_SNAP && spellInfo->GetRecoveryTime() > 0) - { - SpellCooldowns::iterator citr = caster->GetSpellCooldownMap().find(spellInfo->Id); - if (citr != caster->GetSpellCooldownMap().end() && citr->second.needSendToClient) - caster->RemoveSpellCooldown(spellInfo->Id, true); - else - caster->RemoveSpellCooldown(spellInfo->Id, false); - } + SpellCooldowns::iterator citr = caster->GetSpellCooldownMap().find(spellInfo->Id); + if (citr != caster->GetSpellCooldownMap().end() && citr->second.needSendToClient) + caster->RemoveSpellCooldown(spellInfo->Id, true); + else + caster->RemoveSpellCooldown(spellInfo->Id, false); } } + } - void Register() override - { - OnEffectHit += SpellEffectFn(spell_mage_cold_snap_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - } - }; - - SpellScript* GetSpellScript() const override + void Register() override { - return new spell_mage_cold_snap_SpellScript(); + OnEffectHit += SpellEffectFn(spell_mage_cold_snap::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } }; // -543 - Fire Ward // -6143 - Frost Ward -class spell_mage_fire_frost_ward : public SpellScriptLoader +class spell_mage_fire_frost_ward : public spell_mage_incanters_absorbtion_base_AuraScript { -public: - spell_mage_fire_frost_ward() : SpellScriptLoader("spell_mage_fire_frost_ward") { } + PrepareAuraScript(spell_mage_fire_frost_ward); - class spell_mage_fire_frost_ward_AuraScript : public spell_mage_incanters_absorbtion_base_AuraScript + bool Validate(SpellInfo const* /*spellInfo*/) override { - PrepareAuraScript(spell_mage_fire_frost_ward_AuraScript); + return ValidateSpellInfo({ SPELL_MAGE_FROST_WARDING_TRIGGERED, SPELL_MAGE_FROST_WARDING_R1 }); + } - bool Validate(SpellInfo const* /*spellInfo*/) override + void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& canBeRecalculated) + { + canBeRecalculated = false; + if (Unit* caster = GetCaster()) { - return ValidateSpellInfo({ SPELL_MAGE_FROST_WARDING_TRIGGERED, SPELL_MAGE_FROST_WARDING_R1 }); + // +80.68% from sp bonus + float bonus = 0.8068f; + + bonus *= caster->SpellBaseDamageBonusDone(GetSpellInfo()->GetSchoolMask()); + bonus *= caster->CalculateLevelPenalty(GetSpellInfo()); + + amount += int32(bonus); } + } - void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& canBeRecalculated) + void Absorb(AuraEffect* aurEff, DamageInfo& dmgInfo, uint32& absorbAmount) + { + Unit* target = GetTarget(); + if (AuraEffect* talentAurEff = target->GetAuraEffectOfRankedSpell(SPELL_MAGE_FROST_WARDING_R1, EFFECT_0)) { - canBeRecalculated = false; - if (Unit* caster = GetCaster()) + int32 chance = talentAurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue(); // SPELL_EFFECT_DUMMY with NO_TARGET + + if (roll_chance_i(chance)) { - // +80.68% from sp bonus - float bonus = 0.8068f; + int32 bp = dmgInfo.GetDamage(); + target->CastCustomSpell(target, SPELL_MAGE_FROST_WARDING_TRIGGERED, &bp, nullptr, nullptr, true, nullptr, aurEff); + absorbAmount = 0; - bonus *= caster->SpellBaseDamageBonusDone(GetSpellInfo()->GetSchoolMask()); - bonus *= caster->CalculateLevelPenalty(GetSpellInfo()); + // Xinef: trigger Incanters Absorbtion + uint32 damage = dmgInfo.GetDamage(); + Trigger(aurEff, dmgInfo, damage); - amount += int32(bonus); + // Xinef: hack for chaos bolt + if (!dmgInfo.GetSpellInfo() || dmgInfo.GetSpellInfo()->SpellIconID != 3178) + dmgInfo.AbsorbDamage(bp); + + PreventDefaultAction(); } } + } - void Absorb(AuraEffect* aurEff, DamageInfo& dmgInfo, uint32& absorbAmount) - { - Unit* target = GetTarget(); - if (AuraEffect* talentAurEff = target->GetAuraEffectOfRankedSpell(SPELL_MAGE_FROST_WARDING_R1, EFFECT_0)) - { - int32 chance = talentAurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue(); // SPELL_EFFECT_DUMMY with NO_TARGET - - if (roll_chance_i(chance)) - { - int32 bp = dmgInfo.GetDamage(); - target->CastCustomSpell(target, SPELL_MAGE_FROST_WARDING_TRIGGERED, &bp, nullptr, nullptr, true, nullptr, aurEff); - absorbAmount = 0; - - // Xinef: trigger Incanters Absorbtion - uint32 damage = dmgInfo.GetDamage(); - Trigger(aurEff, dmgInfo, damage); - - // Xinef: hack for chaos bolt - if (!dmgInfo.GetSpellInfo() || dmgInfo.GetSpellInfo()->SpellIconID != 3178) - dmgInfo.AbsorbDamage(bp); - - PreventDefaultAction(); - } - } - } - - void Register() override - { - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_mage_fire_frost_ward_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_SCHOOL_ABSORB); - OnEffectAbsorb += AuraEffectAbsorbFn(spell_mage_fire_frost_ward_AuraScript::Absorb, EFFECT_0); - AfterEffectAbsorb += AuraEffectAbsorbFn(spell_mage_fire_frost_ward_AuraScript::Trigger, EFFECT_0); - } - }; - - AuraScript* GetAuraScript() const override + void Register() override { - return new spell_mage_fire_frost_ward_AuraScript(); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_mage_fire_frost_ward::CalculateAmount, EFFECT_0, SPELL_AURA_SCHOOL_ABSORB); + OnEffectAbsorb += AuraEffectAbsorbFn(spell_mage_fire_frost_ward::Absorb, EFFECT_0); + AfterEffectAbsorb += AuraEffectAbsorbFn(spell_mage_fire_frost_ward::Trigger, EFFECT_0); } }; // 54646 - Focus Magic -class spell_mage_focus_magic : public SpellScriptLoader +class spell_mage_focus_magic : public AuraScript { -public: - spell_mage_focus_magic() : SpellScriptLoader("spell_mage_focus_magic") { } + PrepareAuraScript(spell_mage_focus_magic); - class spell_mage_focus_magic_AuraScript : public AuraScript + bool Validate(SpellInfo const* /*spellInfo*/) override { - PrepareAuraScript(spell_mage_focus_magic_AuraScript); - - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo({ SPELL_MAGE_FOCUS_MAGIC_PROC }); - } - - bool Load() override - { - _procTarget = nullptr; - return true; - } - - bool CheckProc(ProcEventInfo& /*eventInfo*/) - { - _procTarget = GetCaster(); - return _procTarget && _procTarget->IsAlive(); - } - - void HandleProc(AuraEffect const* aurEff, ProcEventInfo& /*eventInfo*/) - { - PreventDefaultAction(); - GetTarget()->CastSpell(_procTarget, SPELL_MAGE_FOCUS_MAGIC_PROC, true, nullptr, aurEff); - } - - void Register() override - { - DoCheckProc += AuraCheckProcFn(spell_mage_focus_magic_AuraScript::CheckProc); - OnEffectProc += AuraEffectProcFn(spell_mage_focus_magic_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_MOD_SPELL_CRIT_CHANCE); - } - - private: - Unit* _procTarget; - }; - - AuraScript* GetAuraScript() const override - { - return new spell_mage_focus_magic_AuraScript(); + return ValidateSpellInfo({ SPELL_MAGE_FOCUS_MAGIC_PROC }); } + + bool Load() override + { + _procTarget = nullptr; + return true; + } + + bool CheckProc(ProcEventInfo& /*eventInfo*/) + { + _procTarget = GetCaster(); + return _procTarget && _procTarget->IsAlive(); + } + + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& /*eventInfo*/) + { + PreventDefaultAction(); + GetTarget()->CastSpell(_procTarget, SPELL_MAGE_FOCUS_MAGIC_PROC, true, nullptr, aurEff); + } + + void Register() override + { + DoCheckProc += AuraCheckProcFn(spell_mage_focus_magic::CheckProc); + OnEffectProc += AuraEffectProcFn(spell_mage_focus_magic::HandleProc, EFFECT_0, SPELL_AURA_MOD_SPELL_CRIT_CHANCE); + } + +private: + Unit* _procTarget; }; // -11426 - Ice Barrier -class spell_mage_ice_barrier : public SpellScriptLoader +class spell_mage_ice_barrier_aura : public spell_mage_incanters_absorbtion_base_AuraScript { -public: - spell_mage_ice_barrier() : SpellScriptLoader("spell_mage_ice_barrier") { } + PrepareAuraScript(spell_mage_ice_barrier_aura); + // TODO: Rework static int32 CalculateSpellAmount(Unit* caster, int32 amount, const SpellInfo* spellInfo, const AuraEffect* aurEff) { // +80.68% from sp bonus @@ -789,279 +622,238 @@ public: return amount; } - class spell_mage_ice_barrier_AuraScript : public spell_mage_incanters_absorbtion_base_AuraScript + void CalculateAmount(AuraEffect const* aurEff, int32& amount, bool& canBeRecalculated) { - PrepareAuraScript(spell_mage_ice_barrier_AuraScript); - - void CalculateAmount(AuraEffect const* aurEff, int32& amount, bool& canBeRecalculated) - { - canBeRecalculated = false; - if (Unit* caster = GetCaster()) - amount = CalculateSpellAmount(caster, amount, GetSpellInfo(), aurEff); - } - - void Register() override - { - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_mage_ice_barrier_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_SCHOOL_ABSORB); - AfterEffectAbsorb += AuraEffectAbsorbFn(spell_mage_ice_barrier_AuraScript::Trigger, EFFECT_0); - } - }; - - AuraScript* GetAuraScript() const override - { - return new spell_mage_ice_barrier_AuraScript(); + canBeRecalculated = false; + if (Unit* caster = GetCaster()) + amount = CalculateSpellAmount(caster, amount, GetSpellInfo(), aurEff); } - class spell_mage_ice_barrier_SpellScript : public SpellScript + void Register() override { - PrepareSpellScript(spell_mage_ice_barrier_SpellScript); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_mage_ice_barrier_aura::CalculateAmount, EFFECT_0, SPELL_AURA_SCHOOL_ABSORB); + AfterEffectAbsorb += AuraEffectAbsorbFn(spell_mage_ice_barrier_aura::Trigger, EFFECT_0); + } +}; - SpellCastResult CheckCast() +class spell_mage_ice_barrier : public SpellScript +{ + PrepareSpellScript(spell_mage_ice_barrier); + + // TODO: Rework + static int32 CalculateSpellAmount(Unit* caster, int32 amount, const SpellInfo* spellInfo, const AuraEffect* aurEff) + { + // +80.68% from sp bonus + float bonus = 0.8068f; + + bonus *= caster->SpellBaseDamageBonusDone(spellInfo->GetSchoolMask()); + + // Glyph of Ice Barrier: its weird having a SPELLMOD_ALL_EFFECTS here but its blizzards doing :) + // Glyph of Ice Barrier is only applied at the spell damage bonus because it was already applied to the base value in CalculateSpellDamage + bonus = caster->ApplyEffectModifiers(spellInfo, aurEff->GetEffIndex(), bonus); + + bonus *= caster->CalculateLevelPenalty(spellInfo); + + amount += int32(bonus); + return amount; + } + + SpellCastResult CheckCast() + { + Unit* caster = GetCaster(); + + if (AuraEffect* aurEff = caster->GetAuraEffect(SPELL_AURA_SCHOOL_ABSORB, (SpellFamilyNames)GetSpellInfo()->SpellFamilyName, GetSpellInfo()->SpellIconID, EFFECT_0)) { - Unit* caster = GetCaster(); + int32 newAmount = GetSpellInfo()->Effects[EFFECT_0].CalcValue(caster, nullptr, nullptr); + newAmount = CalculateSpellAmount(caster, newAmount, GetSpellInfo(), aurEff); - if (AuraEffect* aurEff = caster->GetAuraEffect(SPELL_AURA_SCHOOL_ABSORB, (SpellFamilyNames)GetSpellInfo()->SpellFamilyName, GetSpellInfo()->SpellIconID, EFFECT_0)) - { - int32 newAmount = GetSpellInfo()->Effects[EFFECT_0].CalcValue(caster, nullptr, nullptr); - newAmount = CalculateSpellAmount(caster, newAmount, GetSpellInfo(), aurEff); - - if (aurEff->GetAmount() > newAmount) - return SPELL_FAILED_AURA_BOUNCED; - } - - return SPELL_CAST_OK; + if (aurEff->GetAmount() > newAmount) + return SPELL_FAILED_AURA_BOUNCED; } - void Register() override - { - OnCheckCast += SpellCheckCastFn(spell_mage_ice_barrier_SpellScript::CheckCast); - } - }; + return SPELL_CAST_OK; + } - SpellScript* GetSpellScript() const override + void Register() override { - return new spell_mage_ice_barrier_SpellScript; + OnCheckCast += SpellCheckCastFn(spell_mage_ice_barrier::CheckCast); } }; // -11119 - Ignite -class spell_mage_ignite : public SpellScriptLoader +class spell_mage_ignite : public AuraScript { -public: - spell_mage_ignite() : SpellScriptLoader("spell_mage_ignite") { } + PrepareAuraScript(spell_mage_ignite); - class spell_mage_ignite_AuraScript : public AuraScript + bool Validate(SpellInfo const* /*spellInfo*/) override { - PrepareAuraScript(spell_mage_ignite_AuraScript); + return ValidateSpellInfo({ SPELL_MAGE_IGNITE }); + } - bool Validate(SpellInfo const* /*spellInfo*/) override + bool CheckProc(ProcEventInfo& eventInfo) + { + if (!eventInfo.GetActor() || !eventInfo.GetProcTarget()) + return false; + + DamageInfo* damageInfo = eventInfo.GetDamageInfo(); + + if (!damageInfo || !damageInfo->GetSpellInfo()) { - return ValidateSpellInfo({ SPELL_MAGE_IGNITE }); + return false; } - bool CheckProc(ProcEventInfo& eventInfo) + // Molten Armor + if (SpellInfo const* spellInfo = eventInfo.GetSpellInfo()) { - if (!eventInfo.GetActor() || !eventInfo.GetProcTarget()) - return false; - - DamageInfo* damageInfo = eventInfo.GetDamageInfo(); - - if (!damageInfo || !damageInfo->GetSpellInfo()) + if (spellInfo->SpellFamilyFlags[1] & 0x8) { return false; } - - // Molten Armor - if (SpellInfo const* spellInfo = eventInfo.GetSpellInfo()) - { - if (spellInfo->SpellFamilyFlags[1] & 0x8) - { - return false; - } - } - - return true; } - void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo) - { - PreventDefaultAction(); + return true; + } - SpellInfo const* igniteDot = sSpellMgr->AssertSpellInfo(SPELL_MAGE_IGNITE); - int32 pct = 8 * GetSpellInfo()->GetRank(); - - int32 amount = int32(CalculatePct(eventInfo.GetDamageInfo()->GetDamage(), pct) / igniteDot->GetMaxTicks()); - - // Xinef: implement ignite bug - eventInfo.GetProcTarget()->CastDelayedSpellWithPeriodicAmount(eventInfo.GetActor(), SPELL_MAGE_IGNITE, SPELL_AURA_PERIODIC_DAMAGE, amount); - //GetTarget()->CastCustomSpell(SPELL_MAGE_IGNITE, SPELLVALUE_BASE_POINT0, amount, eventInfo.GetProcTarget(), true, nullptr, aurEff); - } - - void Register() override - { - DoCheckProc += AuraCheckProcFn(spell_mage_ignite_AuraScript::CheckProc); - OnEffectProc += AuraEffectProcFn(spell_mage_ignite_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); - } - }; - - AuraScript* GetAuraScript() const override + void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo) { - return new spell_mage_ignite_AuraScript(); + PreventDefaultAction(); + + SpellInfo const* igniteDot = sSpellMgr->AssertSpellInfo(SPELL_MAGE_IGNITE); + int32 pct = 8 * GetSpellInfo()->GetRank(); + + int32 amount = int32(CalculatePct(eventInfo.GetDamageInfo()->GetDamage(), pct) / igniteDot->GetMaxTicks()); + + // Xinef: implement ignite bug + eventInfo.GetProcTarget()->CastDelayedSpellWithPeriodicAmount(eventInfo.GetActor(), SPELL_MAGE_IGNITE, SPELL_AURA_PERIODIC_DAMAGE, amount); + //GetTarget()->CastCustomSpell(SPELL_MAGE_IGNITE, SPELLVALUE_BASE_POINT0, amount, eventInfo.GetProcTarget(), true, nullptr, aurEff); + } + + void Register() override + { + DoCheckProc += AuraCheckProcFn(spell_mage_ignite::CheckProc); + OnEffectProc += AuraEffectProcFn(spell_mage_ignite::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); } }; // -44457 - Living Bomb -class spell_mage_living_bomb : public SpellScriptLoader +class spell_mage_living_bomb : public AuraScript { -public: - spell_mage_living_bomb() : SpellScriptLoader("spell_mage_living_bomb") { } + PrepareAuraScript(spell_mage_living_bomb); - class spell_mage_living_bomb_AuraScript : public AuraScript + bool Validate(SpellInfo const* spell) override { - PrepareAuraScript(spell_mage_living_bomb_AuraScript); + if (!sSpellMgr->GetSpellInfo(uint32(spell->Effects[EFFECT_1].CalcValue()))) + return false; + return true; + } - bool Validate(SpellInfo const* spell) override - { - if (!sSpellMgr->GetSpellInfo(uint32(spell->Effects[EFFECT_1].CalcValue()))) - return false; - return true; - } - - void AfterRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) - { - AuraRemoveMode removeMode = GetTargetApplication()->GetRemoveMode(); - if (removeMode != AURA_REMOVE_BY_ENEMY_SPELL && removeMode != AURA_REMOVE_BY_EXPIRE) - return; - - if (Unit* caster = GetCaster()) - caster->CastSpell(GetTarget(), uint32(aurEff->GetAmount()), true, nullptr, aurEff); - } - - void Register() override - { - AfterEffectRemove += AuraEffectRemoveFn(spell_mage_living_bomb_AuraScript::AfterRemove, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); - } - }; - - AuraScript* GetAuraScript() const override + void AfterRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) { - return new spell_mage_living_bomb_AuraScript(); + AuraRemoveMode removeMode = GetTargetApplication()->GetRemoveMode(); + if (removeMode != AURA_REMOVE_BY_ENEMY_SPELL && removeMode != AURA_REMOVE_BY_EXPIRE) + return; + + if (Unit* caster = GetCaster()) + caster->CastSpell(GetTarget(), uint32(aurEff->GetAmount()), true, nullptr, aurEff); + } + + void Register() override + { + AfterEffectRemove += AuraEffectRemoveFn(spell_mage_living_bomb::AfterRemove, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); } }; // -1463 - Mana Shield -class spell_mage_mana_shield : public SpellScriptLoader +class spell_mage_mana_shield : public spell_mage_incanters_absorbtion_base_AuraScript { -public: - spell_mage_mana_shield() : SpellScriptLoader("spell_mage_mana_shield") { } + PrepareAuraScript(spell_mage_mana_shield); - class spell_mage_mana_shield_AuraScript : public spell_mage_incanters_absorbtion_base_AuraScript + void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& canBeRecalculated) { - PrepareAuraScript(spell_mage_mana_shield_AuraScript); - - void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& canBeRecalculated) + canBeRecalculated = false; + if (Unit* caster = GetCaster()) { - canBeRecalculated = false; - if (Unit* caster = GetCaster()) - { - // +80.53% from sp bonus - float bonus = 0.8053f; + // +80.53% from sp bonus + float bonus = 0.8053f; - bonus *= caster->SpellBaseDamageBonusDone(GetSpellInfo()->GetSchoolMask()); - bonus *= caster->CalculateLevelPenalty(GetSpellInfo()); + bonus *= caster->SpellBaseDamageBonusDone(GetSpellInfo()->GetSchoolMask()); + bonus *= caster->CalculateLevelPenalty(GetSpellInfo()); - amount += int32(bonus); - } + amount += int32(bonus); } + } - void Register() override - { - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_mage_mana_shield_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_MANA_SHIELD); - AfterEffectManaShield += AuraEffectManaShieldFn(spell_mage_mana_shield_AuraScript::Trigger, EFFECT_0); - } - }; - - AuraScript* GetAuraScript() const override + void Register() override { - return new spell_mage_mana_shield_AuraScript(); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_mage_mana_shield::CalculateAmount, EFFECT_0, SPELL_AURA_MANA_SHIELD); + AfterEffectManaShield += AuraEffectManaShieldFn(spell_mage_mana_shield::Trigger, EFFECT_0); } }; // -29074 - Master of Elements -class spell_mage_master_of_elements : public SpellScriptLoader +class spell_mage_master_of_elements : public AuraScript { -public: - spell_mage_master_of_elements() : SpellScriptLoader("spell_mage_master_of_elements") { } + PrepareAuraScript(spell_mage_master_of_elements); - class spell_mage_master_of_elements_AuraScript : public AuraScript + bool Validate(SpellInfo const* /*spellInfo*/) override { - PrepareAuraScript(spell_mage_master_of_elements_AuraScript); + return ValidateSpellInfo({ SPELL_MAGE_MASTER_OF_ELEMENTS_ENERGIZE }); + } - bool Validate(SpellInfo const* /*spellInfo*/) override + bool CheckProc(ProcEventInfo& eventInfo) + { + _spellInfo = eventInfo.GetSpellInfo(); + if (!_spellInfo) { - return ValidateSpellInfo({ SPELL_MAGE_MASTER_OF_ELEMENTS_ENERGIZE }); + return false; } - bool CheckProc(ProcEventInfo& eventInfo) + bool selectCaster = false; + // Triggered spells cost no mana so we need triggering spellInfo + if (SpellInfo const* triggeredByAuraSpellInfo = eventInfo.GetTriggerAuraSpell()) { - _spellInfo = eventInfo.GetSpellInfo(); - if (!_spellInfo) - { - return false; - } + _spellInfo = triggeredByAuraSpellInfo; + selectCaster = true; + } - bool selectCaster = false; - // Triggered spells cost no mana so we need triggering spellInfo - if (SpellInfo const* triggeredByAuraSpellInfo = eventInfo.GetTriggerAuraSpell()) + // If spell is periodic, mana amount is divided by tick number + if (eventInfo.GetTriggerAuraEffectIndex() >= EFFECT_0) + { + if (Unit* caster = GetCaster()) { - _spellInfo = triggeredByAuraSpellInfo; - selectCaster = true; - } - - // If spell is periodic, mana amount is divided by tick number - if (eventInfo.GetTriggerAuraEffectIndex() >= EFFECT_0) - { - if (Unit* caster = GetCaster()) + if (Unit* target = (selectCaster ? eventInfo.GetActor() : eventInfo.GetActionTarget())) { - if (Unit* target = (selectCaster ? eventInfo.GetActor() : eventInfo.GetActionTarget())) + if (AuraEffect const* aurEff = target->GetAuraEffect(_spellInfo->Id, eventInfo.GetTriggerAuraEffectIndex(), caster->GetGUID())) { - if (AuraEffect const* aurEff = target->GetAuraEffect(_spellInfo->Id, eventInfo.GetTriggerAuraEffectIndex(), caster->GetGUID())) - { - ticksModifier = aurEff->GetTotalTicks(); - } + ticksModifier = aurEff->GetTotalTicks(); } } } - - return _spellInfo; // eventInfo.GetSpellInfo() } - void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) - { - PreventDefaultAction(); - - int32 mana = int32(_spellInfo->CalcPowerCost(GetTarget(), eventInfo.GetSchoolMask()) / ticksModifier); - mana = CalculatePct(mana, aurEff->GetAmount()); - - if (mana > 0) - GetTarget()->CastCustomSpell(SPELL_MAGE_MASTER_OF_ELEMENTS_ENERGIZE, SPELLVALUE_BASE_POINT0, mana, GetTarget(), true, nullptr, aurEff); - } - - void Register() override - { - DoCheckProc += AuraCheckProcFn(spell_mage_master_of_elements_AuraScript::CheckProc); - OnEffectProc += AuraEffectProcFn(spell_mage_master_of_elements_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); - } - - private: - SpellInfo const* _spellInfo = nullptr; - uint8 ticksModifier = 1; - }; - - AuraScript* GetAuraScript() const override - { - return new spell_mage_master_of_elements_AuraScript(); + return _spellInfo; // eventInfo.GetSpellInfo() } + + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + { + PreventDefaultAction(); + + int32 mana = int32(_spellInfo->CalcPowerCost(GetTarget(), eventInfo.GetSchoolMask()) / ticksModifier); + mana = CalculatePct(mana, aurEff->GetAmount()); + + if (mana > 0) + GetTarget()->CastCustomSpell(SPELL_MAGE_MASTER_OF_ELEMENTS_ENERGIZE, SPELLVALUE_BASE_POINT0, mana, GetTarget(), true, nullptr, aurEff); + } + + void Register() override + { + DoCheckProc += AuraCheckProcFn(spell_mage_master_of_elements::CheckProc); + OnEffectProc += AuraEffectProcFn(spell_mage_master_of_elements::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); + } + +private: + SpellInfo const* _spellInfo = nullptr; + uint8 ticksModifier = 1; }; enum SilvermoonPolymorph @@ -1071,46 +863,35 @@ enum SilvermoonPolymorph /// @todo move out of here and rename - not a mage spell // 32826 - Polymorph (Visual) -class spell_mage_polymorph_cast_visual : public SpellScriptLoader +class spell_mage_polymorph_cast_visual : public SpellScript { -public: - spell_mage_polymorph_cast_visual() : SpellScriptLoader("spell_mage_polymorph_visual") { } + PrepareSpellScript(spell_mage_polymorph_cast_visual); - class spell_mage_polymorph_cast_visual_SpellScript : public SpellScript + static const uint32 PolymorhForms[6]; + + bool Validate(SpellInfo const* /*spellInfo*/) override { - PrepareSpellScript(spell_mage_polymorph_cast_visual_SpellScript); + // check if spell ids exist in dbc + for (uint32 i = 0; i < 6; ++i) + if (!sSpellMgr->GetSpellInfo(PolymorhForms[i])) + return false; + return true; + } - static const uint32 PolymorhForms[6]; - - bool Validate(SpellInfo const* /*spellInfo*/) override - { - // check if spell ids exist in dbc - for (uint32 i = 0; i < 6; ++i) - if (!sSpellMgr->GetSpellInfo(PolymorhForms[i])) - return false; - return true; - } - - void HandleDummy(SpellEffIndex /*effIndex*/) - { - if (Unit* target = GetCaster()->FindNearestCreature(NPC_AUROSALIA, 30.0f)) - if (target->GetTypeId() == TYPEID_UNIT) - target->CastSpell(target, PolymorhForms[urand(0, 5)], true); - } - - void Register() override - { - OnEffectHitTarget += SpellEffectFn(spell_mage_polymorph_cast_visual_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - } - }; - - SpellScript* GetSpellScript() const override + void HandleDummy(SpellEffIndex /*effIndex*/) { - return new spell_mage_polymorph_cast_visual_SpellScript(); + if (Unit* target = GetCaster()->FindNearestCreature(NPC_AUROSALIA, 30.0f)) + if (target->GetTypeId() == TYPEID_UNIT) + target->CastSpell(target, PolymorhForms[urand(0, 5)], true); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_mage_polymorph_cast_visual::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } }; -const uint32 spell_mage_polymorph_cast_visual::spell_mage_polymorph_cast_visual_SpellScript::PolymorhForms[6] = +const uint32 spell_mage_polymorph_cast_visual::spell_mage_polymorph_cast_visual::PolymorhForms[6] = { SPELL_MAGE_SQUIRREL_FORM, SPELL_MAGE_GIRAFFE_FORM, @@ -1121,86 +902,72 @@ const uint32 spell_mage_polymorph_cast_visual::spell_mage_polymorph_cast_visual_ }; // 31687 - Summon Water Elemental -class spell_mage_summon_water_elemental : public SpellScriptLoader +class spell_mage_summon_water_elemental : public SpellScript { -public: - spell_mage_summon_water_elemental() : SpellScriptLoader("spell_mage_summon_water_elemental") { } - - class spell_mage_summon_water_elemental_SpellScript : public SpellScript + PrepareSpellScript(spell_mage_summon_water_elemental) + bool Validate(SpellInfo const* /*spellEntry*/) override { - PrepareSpellScript(spell_mage_summon_water_elemental_SpellScript) - bool Validate(SpellInfo const* /*spellEntry*/) override - { - return ValidateSpellInfo( - { - SPELL_MAGE_GLYPH_OF_ETERNAL_WATER, - SPELL_MAGE_SUMMON_WATER_ELEMENTAL_TEMPORARY, - SPELL_MAGE_SUMMON_WATER_ELEMENTAL_PERMANENT - }); - } + return ValidateSpellInfo( + { + SPELL_MAGE_GLYPH_OF_ETERNAL_WATER, + SPELL_MAGE_SUMMON_WATER_ELEMENTAL_TEMPORARY, + SPELL_MAGE_SUMMON_WATER_ELEMENTAL_PERMANENT + }); + } - void HandleDummy(SpellEffIndex /*effIndex*/) - { - Unit* caster = GetCaster(); - - if (Creature* pet = ObjectAccessor::GetCreature(*caster, caster->GetPetGUID())) - if (!pet->IsAlive()) - pet->ToTempSummon()->UnSummon(); - - // Glyph of Eternal Water - if (caster->HasAura(SPELL_MAGE_GLYPH_OF_ETERNAL_WATER)) - caster->CastSpell(caster, SPELL_MAGE_SUMMON_WATER_ELEMENTAL_PERMANENT, true); - else - caster->CastSpell(caster, SPELL_MAGE_SUMMON_WATER_ELEMENTAL_TEMPORARY, true); - - if (Creature* pet = ObjectAccessor::GetCreature(*caster, caster->GetPetGUID())) - if (pet->GetCharmInfo() && caster->ToPlayer()) - { - pet->m_CreatureSpellCooldowns.clear(); - const SpellInfo* spellEntry = sSpellMgr->GetSpellInfo(31707); - pet->GetCharmInfo()->ToggleCreatureAutocast(spellEntry, true); - pet->GetCharmInfo()->SetSpellAutocast(spellEntry, true); - caster->ToPlayer()->CharmSpellInitialize(); - } - } - - void Register() override - { - OnEffectHit += SpellEffectFn(spell_mage_summon_water_elemental_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - } - }; - - SpellScript* GetSpellScript() const override + void HandleDummy(SpellEffIndex /*effIndex*/) { - return new spell_mage_summon_water_elemental_SpellScript(); + Unit* caster = GetCaster(); + + if (Creature* pet = ObjectAccessor::GetCreature(*caster, caster->GetPetGUID())) + if (!pet->IsAlive()) + pet->ToTempSummon()->UnSummon(); + + // Glyph of Eternal Water + if (caster->HasAura(SPELL_MAGE_GLYPH_OF_ETERNAL_WATER)) + caster->CastSpell(caster, SPELL_MAGE_SUMMON_WATER_ELEMENTAL_PERMANENT, true); + else + caster->CastSpell(caster, SPELL_MAGE_SUMMON_WATER_ELEMENTAL_TEMPORARY, true); + + if (Creature* pet = ObjectAccessor::GetCreature(*caster, caster->GetPetGUID())) + if (pet->GetCharmInfo() && caster->ToPlayer()) + { + pet->m_CreatureSpellCooldowns.clear(); + const SpellInfo* spellEntry = sSpellMgr->GetSpellInfo(31707); + pet->GetCharmInfo()->ToggleCreatureAutocast(spellEntry, true); + pet->GetCharmInfo()->SetSpellAutocast(spellEntry, true); + caster->ToPlayer()->CharmSpellInitialize(); + } + } + + void Register() override + { + OnEffectHit += SpellEffectFn(spell_mage_summon_water_elemental::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } }; void AddSC_mage_spell_scripts() { - // Ours - new spell_mage_arcane_blast(); - new spell_mage_deep_freeze(); - new spell_mage_burning_determination(); - new spell_mage_molten_armor(); - new spell_mage_mirror_image(); - new spell_mage_burnout(); - new spell_mage_burnout_trigger(); - new spell_mage_pet_scaling(); - new spell_mage_brain_freeze(); - new spell_mage_glyph_of_eternal_water(); - new spell_mage_combustion_proc(); - - // Theirs - new spell_mage_blast_wave(); - new spell_mage_cold_snap(); - new spell_mage_fire_frost_ward(); - new spell_mage_focus_magic(); - new spell_mage_ice_barrier(); - new spell_mage_ignite(); - new spell_mage_living_bomb(); - new spell_mage_mana_shield(); - new spell_mage_master_of_elements(); - new spell_mage_polymorph_cast_visual(); - new spell_mage_summon_water_elemental(); + RegisterSpellScript(spell_mage_arcane_blast); + RegisterSpellScript(spell_mage_deep_freeze); + RegisterSpellScript(spell_mage_burning_determination); + RegisterSpellScript(spell_mage_molten_armor); + RegisterSpellScript(spell_mage_mirror_image); + RegisterSpellScript(spell_mage_burnout); + RegisterSpellScript(spell_mage_burnout_trigger); + RegisterSpellScript(spell_mage_pet_scaling); + RegisterSpellScript(spell_mage_brain_freeze); + RegisterSpellScript(spell_mage_glyph_of_eternal_water); + RegisterSpellScript(spell_mage_combustion_proc); + RegisterSpellScript(spell_mage_blast_wave); + RegisterSpellScript(spell_mage_cold_snap); + RegisterSpellScript(spell_mage_fire_frost_ward); + RegisterSpellScript(spell_mage_focus_magic); + RegisterSpellScript(spell_mage_ice_barrier); + RegisterSpellScript(spell_mage_ignite); + RegisterSpellScript(spell_mage_living_bomb); + RegisterSpellScript(spell_mage_mana_shield); + RegisterSpellScript(spell_mage_master_of_elements); + RegisterSpellScript(spell_mage_polymorph_cast_visual); + RegisterSpellScript(spell_mage_summon_water_elemental); }