Scripts/Spells: Implement druid talent Nature's Grace (#30215)

This commit is contained in:
Aqua Deus
2024-09-29 20:25:00 +02:00
committed by GitHub
parent eee5dfac17
commit db75f34239
2 changed files with 68 additions and 0 deletions

View File

@@ -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

View File

@@ -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,
@@ -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,
@@ -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
@@ -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>());