diff --git a/data/sql/updates/pending_db_world/rev_1747581578778876200.sql b/data/sql/updates/pending_db_world/rev_1747581578778876200.sql new file mode 100644 index 00000000000000..7c80d0f87a77b8 --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1747581578778876200.sql @@ -0,0 +1,3 @@ +-- Moonglade Raiment 2 set +DELETE FROM `spell_script_names` WHERE `spell_id`=-774 AND `ScriptName`='spell_dru_rejuvenation_moonglade_2_set'; +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES (-774, 'spell_dru_rejuvenation_moonglade_2_set'); diff --git a/src/server/scripts/Spells/spell_druid.cpp b/src/server/scripts/Spells/spell_druid.cpp index 0813b9ecae154d..ededde81ebc1fc 100644 --- a/src/server/scripts/Spells/spell_druid.cpp +++ b/src/server/scripts/Spells/spell_druid.cpp @@ -60,6 +60,7 @@ enum DruidSpells SPELL_DRUID_ENRAGE = 5229, SPELL_DRUID_ENRAGED_DEFENSE = 70725, SPELL_DRUID_ITEM_T10_FERAL_4P_BONUS = 70726, + SPELL_DRUID_MOONGLADE_2P_BONUS = 37286 }; enum DruidIcons @@ -1194,6 +1195,60 @@ class spell_dru_moonkin_form_passive_proc : public AuraScript } }; +// -774 - Rejuvenation +class spell_dru_rejuvenation_moonglade_2_set : public AuraScript +{ + PrepareAuraScript(spell_dru_rejuvenation_moonglade_2_set); + + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_DRUID_MOONGLADE_2P_BONUS }); + } + + bool Load() override + { + _casterGUID.Clear(); + return true; + } + + void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (Player* caster = ObjectAccessor::FindPlayer(GetCasterGUID())) + if (caster->HasAura(SPELL_DRUID_MOONGLADE_2P_BONUS)) + { + Player* target = GetTarget()->ToPlayer(); + if (!target) + return; + + _casterGUID = GetCasterGUID(); + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(SPELL_DRUID_MOONGLADE_2P_BONUS); + target->ApplyRatingMod(CR_DODGE, spellInfo->Effects[EFFECT_0].CalcValue(), true); // 35 rating + } + } + + void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (_casterGUID) + { + Player* target = GetTarget()->ToPlayer(); + if (!target) + return; + + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(SPELL_DRUID_MOONGLADE_2P_BONUS); + target->ApplyRatingMod(CR_DODGE, spellInfo->Effects[EFFECT_0].CalcValue(), false); // 35 rating + } + } + + void Register() override + { + AfterEffectApply += AuraEffectApplyFn(spell_dru_rejuvenation_moonglade_2_set::OnApply, EFFECT_0, SPELL_AURA_PERIODIC_HEAL, AURA_EFFECT_HANDLE_REAL); + AfterEffectRemove += AuraEffectRemoveFn(spell_dru_rejuvenation_moonglade_2_set::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_HEAL, AURA_EFFECT_HANDLE_REAL); + } + +private: + ObjectGuid _casterGUID; +}; + void AddSC_druid_spell_scripts() { RegisterSpellScript(spell_dru_bear_form_passive); @@ -1229,4 +1284,5 @@ void AddSC_druid_spell_scripts() RegisterSpellScript(spell_dru_t10_restoration_4p_bonus); RegisterSpellScript(spell_dru_wild_growth); RegisterSpellScript(spell_dru_moonkin_form_passive_proc); + RegisterSpellScript(spell_dru_rejuvenation_moonglade_2_set); }