diff options
-rw-r--r-- | sql/updates/world/master/2022_02_10_02_world.sql | 8 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_mage.cpp | 107 |
2 files changed, 86 insertions, 29 deletions
diff --git a/sql/updates/world/master/2022_02_10_02_world.sql b/sql/updates/world/master/2022_02_10_02_world.sql new file mode 100644 index 00000000000..78e963a444d --- /dev/null +++ b/sql/updates/world/master/2022_02_10_02_world.sql @@ -0,0 +1,8 @@ +DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_mage_trigger_chilled'; +DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_mage_frostbolt'; +DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_mage_blizzard_damage'; +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(116,'spell_mage_frostbolt'), +(190357,'spell_mage_blizzard_damage'); + +UPDATE `areatrigger_create_properties` SET `TimeToTargetScale`=0, `ScriptName`='areatrigger_mage_blizzard', `VerifiedBuild`=42010 WHERE `Id`=4658; -- SpellId : 190356 diff --git a/src/server/scripts/Spells/spell_mage.cpp b/src/server/scripts/Spells/spell_mage.cpp index 13012dc6fbc..8add970f119 100644 --- a/src/server/scripts/Spells/spell_mage.cpp +++ b/src/server/scripts/Spells/spell_mage.cpp @@ -21,12 +21,13 @@ * Scriptnames of files in this file should be prefixed with "spell_mage_". */ -#include "ScriptMgr.h" +#include "AreaTrigger.h" +#include "AreaTriggerAI.h" #include "DB2Stores.h" #include "GridNotifiers.h" #include "ObjectAccessor.h" -#include "Pet.h" #include "Player.h" +#include "ScriptMgr.h" #include "SpellAuraEffects.h" #include "SpellHistory.h" #include "SpellMgr.h" @@ -43,8 +44,11 @@ enum MageSpells SPELL_MAGE_ARCANE_MAGE = 137021, SPELL_MAGE_BLAZING_BARRIER_TRIGGER = 235314, SPELL_MAGE_BLINK = 1953, + SPELL_MAGE_BLIZZARD_DAMAGE = 190357, + SPELL_MAGE_BLIZZARD_SLOW = 12486, SPELL_MAGE_CAUTERIZE_DOT = 87023, SPELL_MAGE_CAUTERIZED = 87024, + SPELL_MAGE_CHILLED = 205708, SPELL_MAGE_COMET_STORM_DAMAGE = 153596, SPELL_MAGE_COMET_STORM_VISUAL = 228601, SPELL_MAGE_CONE_OF_COLD = 120, @@ -88,8 +92,7 @@ enum MiscSpells { SPELL_HUNTER_INSANITY = 95809, SPELL_SHAMAN_EXHAUSTION = 57723, - SPELL_SHAMAN_SATED = 57724, - SPELL_MAGE_CHILLED = 205708 + SPELL_SHAMAN_SATED = 57724 }; // 110909 - Alter Time Aura @@ -317,6 +320,52 @@ class spell_mage_blazing_barrier : public AuraScript } }; +// 190356 - Blizzard +// 4658 - AreaTrigger Create Properties +struct areatrigger_mage_blizzard : AreaTriggerAI +{ + areatrigger_mage_blizzard(AreaTrigger* areatrigger) : AreaTriggerAI(areatrigger), _tickTimer(TICK_PERIOD) { } + + static constexpr Milliseconds TICK_PERIOD = Milliseconds(1000); + + void OnUpdate(uint32 diff) override + { + _tickTimer -= Milliseconds(diff); + + while (_tickTimer <= 0s) + { + if (Unit* caster = at->GetCaster()) + caster->CastSpell(at->GetPosition(), SPELL_MAGE_BLIZZARD_DAMAGE); + + _tickTimer += TICK_PERIOD; + } + } + +private: + Milliseconds _tickTimer; +}; + +// 190357 - Blizzard (Damage) +class spell_mage_blizzard_damage : public SpellScript +{ + PrepareSpellScript(spell_mage_blizzard_damage); + + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_MAGE_BLIZZARD_SLOW }); + } + + void HandleSlow(SpellEffIndex /*effIndex*/) + { + GetCaster()->CastSpell(GetHitUnit(), SPELL_MAGE_BLIZZARD_SLOW, TRIGGERED_IGNORE_CAST_IN_PROGRESS); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_mage_blizzard_damage::HandleSlow, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE); + } +}; + // 198063 - Burning Determination class spell_mage_burning_determination : public AuraScript { @@ -661,6 +710,28 @@ class spell_mage_flame_on : public AuraScript } }; +// 116 - Frostbolt +class spell_mage_frostbolt : public SpellScript +{ + PrepareSpellScript(spell_mage_frostbolt); + + bool Validate(SpellInfo const* /*spell*/) override + { + return ValidateSpellInfo({ SPELL_MAGE_CHILLED }); + } + + void HandleChilled() + { + if (Unit* target = GetHitUnit()) + GetCaster()->CastSpell(target, SPELL_MAGE_CHILLED, TRIGGERED_IGNORE_CAST_IN_PROGRESS); + } + + void Register() override + { + OnHit += SpellHitFn(spell_mage_frostbolt::HandleChilled); + } +}; + // 11426 - Ice Barrier class spell_mage_ice_barrier : public AuraScript { @@ -1237,30 +1308,6 @@ class spell_mage_touch_of_the_magi_aura : public AuraScript } }; -/* 228597 - Frostbolt - 84721 - Frozen Orb - 190357 - Blizzard */ -class spell_mage_trigger_chilled : public SpellScript -{ - PrepareSpellScript(spell_mage_trigger_chilled); - - bool Validate(SpellInfo const* /*spell*/) override - { - return ValidateSpellInfo({ SPELL_MAGE_CHILLED }); - } - - void HandleChilled() - { - if (Unit* target = GetHitUnit()) - GetCaster()->CastSpell(target, SPELL_MAGE_CHILLED, true); - } - - void Register() override - { - OnHit += SpellHitFn(spell_mage_trigger_chilled::HandleChilled); - } -}; - // 33395 Water Elemental's Freeze class spell_mage_water_elemental_freeze : public SpellScript { @@ -1294,6 +1341,8 @@ void AddSC_mage_spell_scripts() RegisterSpellScript(spell_mage_arcane_charge_clear); RegisterSpellScript(spell_mage_arcane_explosion); RegisterSpellScript(spell_mage_blazing_barrier); + RegisterAreaTriggerAI(areatrigger_mage_blizzard); + RegisterSpellScript(spell_mage_blizzard_damage); RegisterSpellScript(spell_mage_burning_determination); RegisterSpellAndAuraScriptPair(spell_mage_cauterize, spell_mage_cauterize_AuraScript); RegisterSpellScript(spell_mage_cold_snap); @@ -1305,6 +1354,7 @@ void AddSC_mage_spell_scripts() RegisterSpellScript(spell_mage_firestarter); RegisterSpellScript(spell_mage_firestarter_dots); RegisterSpellScript(spell_mage_flame_on); + RegisterSpellScript(spell_mage_frostbolt); RegisterSpellScript(spell_mage_ice_barrier); RegisterSpellScript(spell_mage_ice_block); RegisterSpellScript(spell_mage_ice_lance); @@ -1321,6 +1371,5 @@ void AddSC_mage_spell_scripts() RegisterSpellAndAuraScriptPair(spell_mage_ring_of_frost_freeze, spell_mage_ring_of_frost_freeze_AuraScript); RegisterSpellScript(spell_mage_time_warp); RegisterSpellScript(spell_mage_touch_of_the_magi_aura); - RegisterSpellScript(spell_mage_trigger_chilled); RegisterSpellScript(spell_mage_water_elemental_freeze); } |