Scripts/Spells: Implement druid talent Inner Peace (#29186)

This commit is contained in:
Teleqraph
2023-08-20 19:29:01 +02:00
committed by GitHub
parent 30d304298c
commit 119200b745
2 changed files with 30 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
DELETE FROM `spell_script_names` WHERE `ScriptName` IN ('spell_dru_inner_peace');
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
(740, 'spell_dru_inner_peace');

View File

@@ -89,6 +89,7 @@ enum DruidSpells
SPELL_DRUID_INCARNATION = 117679,
SPELL_DRUID_INCARNATION_KING_OF_THE_JUNGLE = 102543,
SPELL_DRUID_INCARNATION_TREE_OF_LIFE = 33891,
SPELL_DRUID_INNER_PEACE = 197073,
SPELL_DRUID_INNERVATE = 29166,
SPELL_DRUID_INNERVATE_RANK_2 = 326228,
SPELL_DRUID_INFUSION = 37238,
@@ -1036,6 +1037,31 @@ class spell_dru_incarnation_tree_of_life : public AuraScript
}
};
// 740 - Tranquility
class spell_dru_inner_peace : public SpellScript
{
bool Validate(SpellInfo const* spellInfo) override
{
return ValidateSpellInfo({ SPELL_DRUID_INNER_PEACE })
&& ValidateSpellEffect({ { spellInfo->Id, EFFECT_4 } })
&& spellInfo->GetEffect(EFFECT_3).IsAura(SPELL_AURA_MECHANIC_IMMUNITY_MASK)
&& spellInfo->GetEffect(EFFECT_4).IsAura(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN);
}
void PreventEffect(WorldObject*& target) const
{
// Note: Inner Peace talent.
if (!GetCaster()->HasAura(SPELL_DRUID_INNER_PEACE))
target = nullptr;
}
void Register() override
{
OnObjectTargetSelect += SpellObjectTargetSelectFn(spell_dru_inner_peace::PreventEffect, EFFECT_3, TARGET_UNIT_CASTER);
OnObjectTargetSelect += SpellObjectTargetSelectFn(spell_dru_inner_peace::PreventEffect, EFFECT_4, TARGET_UNIT_CASTER);
}
};
// 40442 - Druid Tier 6 Trinket
class spell_dru_item_t6_trinket : public AuraScript
{
@@ -2072,6 +2098,7 @@ void AddSC_druid_spell_scripts()
RegisterSpellScript(spell_dru_incapacitating_roar);
RegisterSpellScript(spell_dru_incarnation);
RegisterSpellScript(spell_dru_incarnation_tree_of_life);
RegisterSpellScript(spell_dru_inner_peace);
RegisterSpellScript(spell_dru_innervate);
RegisterSpellScript(spell_dru_item_t6_trinket);
RegisterSpellScript(spell_dru_lifebloom);