From a6dd3a1946be27acab80b78b71eecae7dbad82e6 Mon Sep 17 00:00:00 2001 From: Teleqraph Date: Mon, 14 Feb 2022 12:02:29 +0100 Subject: Scripts/Spells: Fixed Cold Snap (#27734) --- src/server/scripts/Spells/spell_mage.cpp | 33 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Spells/spell_mage.cpp b/src/server/scripts/Spells/spell_mage.cpp index 6b2b28f50f4..ff13accd597 100644 --- a/src/server/scripts/Spells/spell_mage.cpp +++ b/src/server/scripts/Spells/spell_mage.cpp @@ -447,33 +447,24 @@ class spell_mage_cold_snap : public SpellScript { PrepareSpellScript(spell_mage_cold_snap); + static uint32 constexpr SpellsToReset[] = + { + SPELL_MAGE_CONE_OF_COLD, + SPELL_MAGE_ICE_BARRIER, + SPELL_MAGE_ICE_BLOCK, + }; + bool Validate(SpellInfo const* /*spellInfo*/) override { - return ValidateSpellInfo - ({ - SPELL_MAGE_CONE_OF_COLD, - SPELL_MAGE_FROST_NOVA, - SPELL_MAGE_ICE_BARRIER, - SPELL_MAGE_ICE_BLOCK - }); + return ValidateSpellInfo(SpellsToReset) && ValidateSpellInfo({ SPELL_MAGE_FROST_NOVA }); } void HandleDummy(SpellEffIndex /*effIndex*/) { - GetCaster()->GetSpellHistory()->ResetCooldowns([](SpellHistory::CooldownStorageType::iterator itr) - { - switch (itr->first) - { - case SPELL_MAGE_CONE_OF_COLD: - case SPELL_MAGE_FROST_NOVA: - case SPELL_MAGE_ICE_BARRIER: - case SPELL_MAGE_ICE_BLOCK: - return true; - default: - break; - } - return false; - }, true); + for (uint32 spellId : SpellsToReset) + GetCaster()->GetSpellHistory()->ResetCooldown(spellId, true); + + GetCaster()->GetSpellHistory()->RestoreCharge(sSpellMgr->AssertSpellInfo(SPELL_MAGE_FROST_NOVA, GetCastDifficulty())->ChargeCategoryId); } void Register() override -- cgit v1.2.3