Skip to content

Commit

Permalink
Scripts/Spells: Implement druid talent Nature's Grace (TrinityCore#30215
Browse files Browse the repository at this point in the history
)
  • Loading branch information
aquadeus authored Sep 29, 2024
1 parent eee5dfa commit db75f34
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 0 deletions.
9 changes: 9 additions & 0 deletions sql/updates/world/master/2024_09_29_01_world.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
DELETE FROM `spell_script_names` WHERE `ScriptName` IN ('spell_dru_natures_grace_eclipse', 'spell_dru_natures_grace');
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
(48517, 'spell_dru_natures_grace_eclipse'),
(48518, 'spell_dru_natures_grace_eclipse'),
(450347, 'spell_dru_natures_grace');

DELETE FROM `spell_proc` WHERE `SpellId` IN (450346);
INSERT INTO `spell_proc` (`SpellId`,`SchoolMask`,`SpellFamilyName`,`SpellFamilyMask0`,`SpellFamilyMask1`,`SpellFamilyMask2`,`SpellFamilyMask3`,`ProcFlags`,`ProcFlags2`,`SpellTypeMask`,`SpellPhaseMask`,`HitMask`,`AttributesMask`,`DisableEffectsMask`,`ProcsPerMinute`,`Chance`,`Cooldown`,`Charges`) VALUES
(450346,0x00,7,0x00000005,0x00000000,0x00000000,0x00000000,0x0,0x0,0x1,0x1,0x0,0x18,0x0,0,0,0,0); -- Dreamstate
59 changes: 59 additions & 0 deletions src/server/scripts/Spells/spell_druid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ enum DruidSpells
SPELL_DRUID_CULTIVATION = 200390,
SPELL_DRUID_CULTIVATION_HEAL = 200389,
SPELL_DRUID_CURIOUS_BRAMBLEPATCH = 330670,
SPELL_DRUID_DREAMSTATE = 450346,
SPELL_DRUID_EARTHWARDEN_AURA = 203975,
SPELL_DRUID_ECLIPSE_DUMMY = 79577,
SPELL_DRUID_ECLIPSE_LUNAR_AURA = 48518,
Expand Down Expand Up @@ -107,6 +108,7 @@ enum DruidSpells
SPELL_DRUID_MANGLE = 33917,
SPELL_DRUID_MASS_ENTANGLEMENT = 102359,
SPELL_DRUID_MOONFIRE_DAMAGE = 164812,
SPELL_DRUID_NATURES_GRACE_TALENT = 450347,
SPELL_DRUID_NEW_MOON = 274281,
SPELL_DRUID_NEW_MOON_OVERRIDE = 274295,
SPELL_DRUID_POWER_OF_THE_ARCHDRUID = 392302,
Expand Down Expand Up @@ -1341,6 +1343,61 @@ class spell_dru_moonfire : public SpellScript
}
};

// 450347 - Nature's Grace
class spell_dru_natures_grace : public AuraScript
{
public:
bool Validate(SpellInfo const* spellInfo) override
{
return ValidateSpellInfo({ SPELL_DRUID_NATURES_GRACE_TALENT, SPELL_DRUID_DREAMSTATE })
&& ValidateSpellEffect({ { spellInfo->Id, EFFECT_2 } });
}

static void Trigger(Unit* caster, AuraEffect const* naturesGraceEffect)
{
caster->CastSpell(caster, SPELL_DRUID_DREAMSTATE, CastSpellExtraArgsInit{
.SpellValueOverrides = { { SPELLVALUE_AURA_STACK, naturesGraceEffect->GetAmount() } }
});

}

void OnOwnerInCombat(bool isNowInCombat) const
{
if (isNowInCombat)
Trigger(GetTarget(), GetEffect(EFFECT_2));
}

void Register() override
{
OnEnterLeaveCombat += AuraEnterLeaveCombatFn(spell_dru_natures_grace::OnOwnerInCombat);
}
};

// 48517 Eclipse (Solar) + 48518 Eclipse (Lunar)
class spell_dru_natures_grace_eclipse : public AuraScript
{
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_DRUID_DREAMSTATE })
&& ValidateSpellEffect({ { SPELL_DRUID_NATURES_GRACE_TALENT, EFFECT_2 } });
}

bool Load() override
{
return GetCaster()->HasAuraEffect(SPELL_DRUID_NATURES_GRACE_TALENT, EFFECT_2);
}

void HandleRemoved(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) const
{
spell_dru_natures_grace::Trigger(GetTarget(), GetTarget()->GetAuraEffect(SPELL_DRUID_NATURES_GRACE_TALENT, EFFECT_2));
}

void Register() override
{
AfterEffectRemove += AuraEffectRemoveFn(spell_dru_natures_grace_eclipse::HandleRemoved, EFFECT_0, SPELL_AURA_ADD_PCT_MODIFIER, AURA_EFFECT_HANDLE_REAL);
}
};

// 274283 - Full Moon
// 274282 - Half Moon
// 274281 - New Moon
Expand Down Expand Up @@ -2301,6 +2358,8 @@ void AddSC_druid_spell_scripts()
RegisterSpellScript(spell_dru_lunar_inspiration);
RegisterSpellScript(spell_dru_luxuriant_soil);
RegisterSpellScript(spell_dru_moonfire);
RegisterSpellScript(spell_dru_natures_grace);
RegisterSpellScript(spell_dru_natures_grace_eclipse);
RegisterSpellScriptWithArgs(spell_dru_new_moon, "spell_dru_full_moon", Optional<DruidSpells>(), Optional<DruidSpells>(SPELL_DRUID_HALF_MOON_OVERRIDE));
RegisterSpellScriptWithArgs(spell_dru_new_moon, "spell_dru_half_moon", Optional<DruidSpells>(SPELL_DRUID_HALF_MOON_OVERRIDE), Optional<DruidSpells>(SPELL_DRUID_NEW_MOON_OVERRIDE));
RegisterSpellScriptWithArgs(spell_dru_new_moon, "spell_dru_new_moon", Optional<DruidSpells>(SPELL_DRUID_NEW_MOON_OVERRIDE), Optional<DruidSpells>());
Expand Down

0 comments on commit db75f34

Please sign in to comment.