diff options
Diffstat (limited to 'src/server/scripts')
-rw-r--r-- | src/server/scripts/Spells/spell_druid.cpp | 125 |
1 files changed, 125 insertions, 0 deletions
diff --git a/src/server/scripts/Spells/spell_druid.cpp b/src/server/scripts/Spells/spell_druid.cpp index 0bd7397f1d4..cdfb62bd55c 100644 --- a/src/server/scripts/Spells/spell_druid.cpp +++ b/src/server/scripts/Spells/spell_druid.cpp @@ -644,6 +644,130 @@ class spell_dru_insect_swarm : public SpellScriptLoader } }; +enum EclipseSpells +{ + SPELL_DRUID_WRATH = 5176, + SPELL_DRUID_STARFIRE = 2912, + SPELL_DRUID_STARSURGE = 78674, + SPELL_DRUID_ECLIPSE_GENERAL_ENERGIZE = 89265, + SPELL_DRUID_STARSURGE_ENERGIZE = 86605, + SPELL_DRUID_LUNAR_ECLIPSE_MARKER = 67484, // Will make the yellow arrow on eclipse bar point to the blue side (lunar) + SPELL_DRUID_SOLAR_ECLIPSE_MARKER = 67483, // Will make the yellow arrow on eclipse bar point to the yellow side (solar) + SPELL_DRUID_SOLAR_ECLIPSE = 48517, + SPELL_DRUID_LUNAR_ECLIPSE = 48518, + TALENT_TREE_BALANCE = 752, +}; + +// Wrath, Starfire, and Starsurge +class spell_dru_eclipse_energize : public SpellScriptLoader +{ +public: + spell_dru_eclipse_energize() : SpellScriptLoader("spell_dru_eclipse_energize") { } + + class spell_dru_eclipse_energize_SpellScript : public SpellScript + { + PrepareSpellScript(spell_dru_eclipse_energize_SpellScript); + + int32 energizeAmount; + + bool Load() + { + if (GetCaster()->GetTypeId() != TYPEID_PLAYER) + return false; + + if (GetCaster()->ToPlayer()->getClass() != CLASS_DRUID) + return false; + + energizeAmount = 0; + + return true; + } + + void HandleEnergize(SpellEffIndex effIndex) + { + Player* caster = GetCaster()->ToPlayer(); + + // No boomy, no deal. + if (caster->GetPrimaryTalentTree(caster->GetActiveSpec()) != TALENT_TREE_BALANCE) + return; + + switch(GetSpellInfo()->Id) + { + case SPELL_DRUID_WRATH: + { + energizeAmount = -GetSpellInfo()->Effects[effIndex].BasePoints; // -13 + // If we are set to fill the lunar side or we've just logged in with 0 power.. + if ((!caster->HasAura(SPELL_DRUID_SOLAR_ECLIPSE_MARKER) && caster->HasAura(SPELL_DRUID_LUNAR_ECLIPSE_MARKER)) + || caster->GetPower(POWER_ECLIPSE) == 0) + { + caster->CastCustomSpell(caster,SPELL_DRUID_ECLIPSE_GENERAL_ENERGIZE,&energizeAmount,0,0,true); + // If the energize was due to 0 power, cast the eclipse marker aura + if (!caster->HasAura(SPELL_DRUID_LUNAR_ECLIPSE_MARKER)) + caster->CastSpell(caster,SPELL_DRUID_LUNAR_ECLIPSE_MARKER,true); + } + // The energizing effect brought us out of the solar eclipse, remove the aura + if (caster->HasAura(SPELL_DRUID_SOLAR_ECLIPSE) && caster->GetPower(POWER_ECLIPSE) <= 0) + caster->RemoveAurasDueToSpell(SPELL_DRUID_SOLAR_ECLIPSE); + break; + } + case SPELL_DRUID_STARFIRE: + { + energizeAmount = GetSpellInfo()->Effects[effIndex].BasePoints; // 20 + // If we are set to fill the solar side or we've just logged in with 0 power.. + if ((!caster->HasAura(SPELL_DRUID_LUNAR_ECLIPSE_MARKER) && caster->HasAura(SPELL_DRUID_SOLAR_ECLIPSE_MARKER)) + || caster->GetPower(POWER_ECLIPSE) == 0) + { + caster->CastCustomSpell(caster,SPELL_DRUID_ECLIPSE_GENERAL_ENERGIZE,&energizeAmount,0,0,true); + // If the energize was due to 0 power, cast the eclipse marker aura + if (!caster->HasAura(SPELL_DRUID_SOLAR_ECLIPSE_MARKER)) + caster->CastSpell(caster,SPELL_DRUID_SOLAR_ECLIPSE_MARKER,true); + } + // The energizing effect brought us out of the lunar eclipse, remove the aura + if (caster->HasAura(SPELL_DRUID_LUNAR_ECLIPSE) && caster->GetPower(POWER_ECLIPSE) >= 0) + caster->RemoveAura(SPELL_DRUID_LUNAR_ECLIPSE); + break; + } + case SPELL_DRUID_STARSURGE: + { + // If we are set to fill the solar side or we've just logged in with 0 power (confirmed with sniffs) + if ((!caster->HasAura(SPELL_DRUID_LUNAR_ECLIPSE_MARKER) && caster->HasAura(SPELL_DRUID_SOLAR_ECLIPSE_MARKER)) + || caster->GetPower(POWER_ECLIPSE) == 0) + { + energizeAmount = GetSpellInfo()->Effects[effIndex].BasePoints; // 15 + caster->CastCustomSpell(caster,SPELL_DRUID_STARSURGE_ENERGIZE,&energizeAmount,0,0,true); + + // If the energize was due to 0 power, cast the eclipse marker aura + if (!caster->HasAura(SPELL_DRUID_SOLAR_ECLIPSE_MARKER)) + caster->CastSpell(caster,SPELL_DRUID_SOLAR_ECLIPSE_MARKER,true); + } + else if (!caster->HasAura(SPELL_DRUID_SOLAR_ECLIPSE_MARKER) && caster->HasAura(SPELL_DRUID_LUNAR_ECLIPSE_MARKER)) + { + energizeAmount = -GetSpellInfo()->Effects[effIndex].BasePoints; // -15 + caster->CastCustomSpell(caster,SPELL_DRUID_STARSURGE_ENERGIZE,&energizeAmount,0,0,true); + } + // The energizing effect brought us out of the lunar eclipse, remove the aura + if (caster->HasAura(SPELL_DRUID_LUNAR_ECLIPSE) && caster->GetPower(POWER_ECLIPSE) >= 0) + caster->RemoveAura(SPELL_DRUID_LUNAR_ECLIPSE); + // The energizing effect brought us out of the solar eclipse, remove the aura + else if (caster->HasAura(SPELL_DRUID_SOLAR_ECLIPSE) && caster->GetPower(POWER_ECLIPSE) <= 0) + caster->RemoveAura(SPELL_DRUID_SOLAR_ECLIPSE); + break; + } + } + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_dru_eclipse_energize_SpellScript::HandleEnergize, EFFECT_1, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_dru_eclipse_energize_SpellScript; + } +}; + void AddSC_druid_spell_scripts() { new spell_dru_glyph_of_starfire(); @@ -659,4 +783,5 @@ void AddSC_druid_spell_scripts() new spell_dru_savage_roar(); new spell_dru_survival_instincts(); new spell_dru_insect_swarm(); + new spell_dru_eclipse_energize(); } |