diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Spells/Auras/SpellAuras.h | 14 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_shaman.cpp | 83 |
2 files changed, 97 insertions, 0 deletions
diff --git a/src/server/game/Spells/Auras/SpellAuras.h b/src/server/game/Spells/Auras/SpellAuras.h index a282cf4f136..a71fbe0221a 100644 --- a/src/server/game/Spells/Auras/SpellAuras.h +++ b/src/server/game/Spells/Auras/SpellAuras.h @@ -22,6 +22,7 @@ #include "SpellAuraDefines.h" #include "SpellInfo.h" #include "Unit.h" +#include <boost/any.hpp> class SpellInfo; struct SpellModifier; @@ -294,6 +295,16 @@ class TC_GAME_API Aura SpellEffectInfoVector GetSpellEffectInfos() const { return _spelEffectInfos; } SpellEffectInfo const* GetSpellEffectInfo(uint32 index) const; + template<typename T> + T const* GetCastExtraParam(std::string const& key) const + { + auto itr = m_castExtraParams.find(key); + if (itr != m_castExtraParams.end()) + return boost::any_cast<T>(&itr->second); + return nullptr; + } + void SetCastExtraParam(std::string const& keyVal, boost::any&& value) { m_castExtraParams[keyVal] = std::move(value); } + private: void _DeleteRemovedApplications(); protected: @@ -327,6 +338,9 @@ class TC_GAME_API Aura std::chrono::steady_clock::time_point m_lastProcAttemptTime; std::chrono::steady_clock::time_point m_lastProcSuccessTime; + // Used to store extra parameters for an aura, eg. data across different auras + std::unordered_map<std::string, boost::any> m_castExtraParams; + private: Unit::AuraApplicationList m_removedApplications; diff --git a/src/server/scripts/Spells/spell_shaman.cpp b/src/server/scripts/Spells/spell_shaman.cpp index ad43ed92d3e..470272d5da5 100644 --- a/src/server/scripts/Spells/spell_shaman.cpp +++ b/src/server/scripts/Spells/spell_shaman.cpp @@ -34,6 +34,9 @@ enum ShamanSpells { SPELL_SHAMAN_EARTH_SHIELD_HEAL = 379, SPELL_SHAMAN_EARTH_SHOCK = 8042, + SPELL_SHAMAN_EARTHEN_RAGE_PASSIVE = 170374, + SPELL_SHAMAN_EARTHEN_RAGE_PERIODIC = 170377, + SPELL_SHAMAN_EARTHEN_RAGE_DAMAGE = 170379, SPELL_SHAMAN_ELEMENTAL_BLAST_CRIT = 118522, SPELL_SHAMAN_ELEMENTAL_BLAST_HASTE = 173183, SPELL_SHAMAN_ELEMENTAL_BLAST_MASTERY = 173184, @@ -266,6 +269,84 @@ class spell_sha_earth_shield : public SpellScriptLoader } }; +// 170374 - Earthen Rage (Passive) +class spell_sha_earthen_rage_passive : public SpellScriptLoader +{ +public: + spell_sha_earthen_rage_passive() : SpellScriptLoader("spell_sha_earthen_rage_passive") { } + + class spell_sha_earthen_rage_passive_AuraScript : public AuraScript + { + PrepareAuraScript(spell_sha_earthen_rage_passive_AuraScript); + + bool Validate(SpellInfo const* /*spellInfo*/) override + { + if (!sSpellMgr->GetSpellInfo(SPELL_SHAMAN_EARTHEN_RAGE_PERIODIC)) + return false; + if (!sSpellMgr->GetSpellInfo(SPELL_SHAMAN_EARTHEN_RAGE_DAMAGE)) + return false; + return true; + } + + void HandleEffectProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo) + { + PreventDefaultAction(); + GetAura()->SetCastExtraParam("procTargetGUID", eventInfo.GetProcTarget()->GetGUID()); + eventInfo.GetActor()->CastSpell(eventInfo.GetActor(), SPELL_SHAMAN_EARTHEN_RAGE_PERIODIC, true); + } + + void Register() override + { + OnEffectProc += AuraEffectProcFn(spell_sha_earthen_rage_passive_AuraScript::HandleEffectProc, EFFECT_0, SPELL_AURA_DUMMY); + } + }; + + AuraScript* GetAuraScript() const override + { + return new spell_sha_earthen_rage_passive_AuraScript(); + } +}; + +// 170377 - Earthen Rage (Proc Aura) +class spell_sha_earthen_rage_proc_aura : public SpellScriptLoader +{ +public: + spell_sha_earthen_rage_proc_aura() : SpellScriptLoader("spell_sha_earthen_rage_proc_aura") { } + + class spell_sha_earthen_rage_proc_aura_AuraScript : public AuraScript + { + PrepareAuraScript(spell_sha_earthen_rage_proc_aura_AuraScript); + + bool Validate(SpellInfo const* /*spellInfo*/) override + { + if (!sSpellMgr->GetSpellInfo(SPELL_SHAMAN_EARTHEN_RAGE_PASSIVE)) + return false; + if (!sSpellMgr->GetSpellInfo(SPELL_SHAMAN_EARTHEN_RAGE_DAMAGE)) + return false; + return true; + } + + void HandleEffectPeriodic(AuraEffect const* /*aurEff*/) + { + PreventDefaultAction(); + if (Aura const* aura = GetCaster()->GetAura(SPELL_SHAMAN_EARTHEN_RAGE_PASSIVE)) + if (ObjectGuid const* procTargetGUID = aura->GetCastExtraParam<ObjectGuid>("procTargetGUID")) + if (Unit* procTarget = ObjectAccessor::GetUnit(*GetCaster(), *procTargetGUID)) + GetTarget()->CastSpell(procTarget, SPELL_SHAMAN_EARTHEN_RAGE_DAMAGE, true); + } + + void Register() override + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_sha_earthen_rage_proc_aura_AuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); + } + }; + + AuraScript* GetAuraScript() const override + { + return new spell_sha_earthen_rage_proc_aura_AuraScript(); + } +}; + // 117014 - Elemental Blast class spell_sha_elemental_blast : public SpellScriptLoader { @@ -1213,6 +1294,8 @@ void AddSC_shaman_spell_scripts() new spell_sha_bloodlust(); new spell_sha_chain_heal(); new spell_sha_earth_shield(); + new spell_sha_earthen_rage_passive(); + new spell_sha_earthen_rage_proc_aura(); new spell_sha_elemental_blast(); new spell_sha_fire_nova(); new spell_sha_flametongue(); |