aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sql/updates/world/cata_classic/2924_09_22_00_world.sql19
-rw-r--r--src/server/scripts/Spells/spell_druid.cpp193
2 files changed, 212 insertions, 0 deletions
diff --git a/sql/updates/world/cata_classic/2924_09_22_00_world.sql b/sql/updates/world/cata_classic/2924_09_22_00_world.sql
new file mode 100644
index 00000000000..4844e08c441
--- /dev/null
+++ b/sql/updates/world/cata_classic/2924_09_22_00_world.sql
@@ -0,0 +1,19 @@
+DELETE FROM `spell_script_names` WHERE `ScriptName` IN
+('spell_dru_wrath',
+'spell_dru_starfire',
+'spell_dru_starsurge',
+'spell_dru_eclipse_solar',
+'spell_dru_eclipse_lunar',
+'spell_dru_eclipse_mastery_driver_passive');
+
+INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
+(5176, 'spell_dru_wrath'),
+(2912, 'spell_dru_starfire'),
+(78674, 'spell_dru_starsurge'),
+(48517, 'spell_dru_eclipse_solar'),
+(48518, 'spell_dru_eclipse_lunar'),
+(79577, 'spell_dru_eclipse_mastery_driver_passive');
+
+DELETE FROM `spell_proc` WHERE `SpellId`= 79577;
+INSERT INTO `spell_proc` (`SpellId`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellFamilyMask1`, `SpellFamilyMask2`, `SpellFamilyMask3`, `SpellTypeMask`, `SpellPhaseMask`) VALUES
+(79577, 7, 0x1 | 0x4, 0x0, 0x2000000, 0x0, 0x1, 0x2);
diff --git a/src/server/scripts/Spells/spell_druid.cpp b/src/server/scripts/Spells/spell_druid.cpp
index e1b54838ce7..8f0f9d3727f 100644
--- a/src/server/scripts/Spells/spell_druid.cpp
+++ b/src/server/scripts/Spells/spell_druid.cpp
@@ -22,7 +22,200 @@
*/
#include "ScriptMgr.h"
+#include "SpellScript.h"
+#include "SpellInfo.h"
+#include "Unit.h"
+
+namespace Scripts::Spells::Druid
+{
+ enum DruidSpells
+ {
+ SPELL_DRUID_ECLIPSE_ENERGY = 89265,
+ SPELL_DRUID_STARSURGE_ENERGIZE = 86605,
+ SPELL_DRUID_ECLIPSE_MARKER_0 = 67483, // points towards Solar Power
+ SPELL_DRUID_ECLIPSE_MARKER_1 = 67484, // points towards Lunar Power
+ SPELL_DRUID_ECLIPSE_SOLAR = 48517,
+ SPELL_DRUID_ECLIPSE_LUNAR = 48518,
+ SPELL_DRUID_ECLIPSE_SOLAR_OVERRIDE_ACTION_BAR = 94338,
+ SPELL_DRUID_SUNFIRE = 93402
+ };
+
+ namespace EclipseHelper
+ {
+ static void AwardEclipsePower(int32 effectValue, Unit* caster, bool solarPower, bool starsurge = false)
+ {
+ int32 energy = solarPower ? effectValue : -effectValue;
+
+ if (starsurge)
+ {
+ if (caster->HasAura(SPELL_DRUID_ECLIPSE_MARKER_1, caster->GetGUID()))
+ energy *= -1;
+
+ if (energy)
+ caster->CastSpell(nullptr, SPELL_DRUID_STARSURGE_ENERGIZE, CastSpellExtraArgs(TRIGGERED_FULL_MASK).AddSpellBP0(energy));
+
+ return;
+ }
+
+ if ((solarPower && caster->HasAura(SPELL_DRUID_ECLIPSE_MARKER_1, caster->GetGUID())) || (!solarPower && caster->HasAura(SPELL_DRUID_ECLIPSE_MARKER_0, caster->GetGUID())))
+ energy = 0;
+
+ if (energy)
+ caster->CastSpell(nullptr, SPELL_DRUID_ECLIPSE_ENERGY, CastSpellExtraArgs(TRIGGERED_FULL_MASK).AddSpellBP0(energy));
+ }
+ }
+
+ // 5176 - Wrath
+ class spell_dru_wrath : public SpellScript
+ {
+ bool Validate(SpellInfo const* spellInfo) override
+ {
+ return ValidateSpellEffect({ { spellInfo->Id, EFFECT_1 } });
+ }
+
+ void HandleEclipsePower(SpellEffIndex /*effIndex*/)
+ {
+ EclipseHelper::AwardEclipsePower(GetSpellInfo()->GetEffect(EFFECT_1).CalcValue(GetCaster()), GetCaster(), false);
+ }
+
+ void Register() override
+ {
+ OnEffectLaunchTarget += SpellEffectFn(spell_dru_wrath::HandleEclipsePower, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE);
+ }
+ };
+
+ // 2912 - Starfire
+ class spell_dru_starfire : public SpellScript
+ {
+ bool Validate(SpellInfo const* spellInfo) override
+ {
+ return ValidateSpellEffect({ { spellInfo->Id, EFFECT_1 } });
+ }
+
+ void HandleEclipsePower(SpellEffIndex /*effIndex*/)
+ {
+ EclipseHelper::AwardEclipsePower(GetSpellInfo()->GetEffect(EFFECT_1).CalcValue(GetCaster()), GetCaster(), true);
+ }
+
+ void Register() override
+ {
+ OnEffectLaunchTarget += SpellEffectFn(spell_dru_starfire::HandleEclipsePower, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE);
+ }
+ };
+
+ // 78674 - Starsurge
+ class spell_dru_starsurge : public SpellScript
+ {
+ bool Validate(SpellInfo const* spellInfo) override
+ {
+ return ValidateSpellEffect({ { spellInfo->Id, EFFECT_1 } });
+ }
+
+ void HandleEclipsePower(SpellEffIndex /*effIndex*/)
+ {
+ EclipseHelper::AwardEclipsePower(GetSpellInfo()->GetEffect(EFFECT_1).CalcValue(GetCaster()), GetCaster(), true, true);
+ }
+
+ void Register() override
+ {
+ OnEffectLaunchTarget += SpellEffectFn(spell_dru_starsurge::HandleEclipsePower, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE);
+ }
+ };
+
+ // 48517 - Eclipse (Solar)
+ class spell_dru_eclipse_solar : public AuraScript
+ {
+ bool Validate(SpellInfo const* /*spellInfo*/) override
+ {
+ return ValidateSpellInfo(
+ {
+ SPELL_DRUID_ECLIPSE_SOLAR_OVERRIDE_ACTION_BAR,
+ SPELL_DRUID_SUNFIRE,
+ SPELL_DRUID_ECLIPSE_MARKER_0,
+ SPELL_DRUID_ECLIPSE_MARKER_1,
+ });
+ }
+
+ void AfterApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
+ {
+ GetTarget()->CastSpell(nullptr, SPELL_DRUID_ECLIPSE_SOLAR_OVERRIDE_ACTION_BAR, CastSpellExtraArgs(aurEff).AddSpellBP0(SPELL_DRUID_SUNFIRE));
+
+ GetTarget()->RemoveAurasDueToSpell(SPELL_DRUID_ECLIPSE_MARKER_0, GetCasterGUID());
+ GetTarget()->CastSpell(nullptr, SPELL_DRUID_ECLIPSE_MARKER_1, aurEff);
+ }
+
+ void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
+ {
+ GetTarget()->RemoveAurasDueToSpell(SPELL_DRUID_ECLIPSE_SOLAR_OVERRIDE_ACTION_BAR, GetCasterGUID());
+ }
+
+ void Register() override
+ {
+ AfterEffectApply += AuraEffectApplyFn(spell_dru_eclipse_solar::AfterApply, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE, AURA_EFFECT_HANDLE_REAL);
+ AfterEffectRemove += AuraEffectApplyFn(spell_dru_eclipse_solar::AfterRemove, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE, AURA_EFFECT_HANDLE_REAL);
+ }
+ };
+
+ // 48518 - Eclipse (Lunar)
+ class spell_dru_eclipse_lunar : public AuraScript
+ {
+ bool Validate(SpellInfo const* /*spellInfo*/) override
+ {
+ return ValidateSpellInfo(
+ {
+ SPELL_DRUID_ECLIPSE_MARKER_0,
+ SPELL_DRUID_ECLIPSE_MARKER_1,
+ });
+ }
+
+ void AfterApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
+ {
+ GetTarget()->RemoveAurasDueToSpell(SPELL_DRUID_ECLIPSE_MARKER_1, GetCasterGUID());
+ GetTarget()->CastSpell(nullptr, SPELL_DRUID_ECLIPSE_MARKER_0, aurEff);
+ }
+
+ void Register() override
+ {
+ AfterEffectApply += AuraEffectApplyFn(spell_dru_eclipse_lunar::AfterApply, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE, AURA_EFFECT_HANDLE_REAL);
+ }
+ };
+
+ // 79577 - Eclipse Mastery Driver Passive
+ class spell_dru_eclipse_mastery_driver_passive : public AuraScript
+ {
+ bool Validate(SpellInfo const* /*spellInfo*/) override
+ {
+ return ValidateSpellInfo(
+ {
+ SPELL_DRUID_ECLIPSE_MARKER_0,
+ SPELL_DRUID_ECLIPSE_MARKER_1,
+ });
+ }
+
+ void HandleEclipseRemoval(ProcEventInfo& /*eventInfo*/)
+ {
+ int32 power = GetTarget()->GetPower(POWER_BALANCE);
+
+ if (power <= 0)
+ GetTarget()->RemoveAurasDueToSpell(SPELL_DRUID_ECLIPSE_SOLAR, GetCasterGUID());
+ else if (power >= 0)
+ GetTarget()->RemoveAurasDueToSpell(SPELL_DRUID_ECLIPSE_LUNAR, GetCasterGUID());
+ }
+
+ void Register() override
+ {
+ AfterProc += AuraProcFn(spell_dru_eclipse_mastery_driver_passive::HandleEclipseRemoval);
+ }
+ };
+}
void AddSC_druid_spell_scripts()
{
+ using namespace Scripts::Spells::Druid;
+ RegisterSpellScript(spell_dru_wrath);
+ RegisterSpellScript(spell_dru_starfire);
+ RegisterSpellScript(spell_dru_starsurge);
+ RegisterSpellScript(spell_dru_eclipse_solar);
+ RegisterSpellScript(spell_dru_eclipse_lunar);
+ RegisterSpellScript(spell_dru_eclipse_mastery_driver_passive);
}