Scripts/Spells: Fixed some code style issues

Follow up: 18e88653b9
This commit is contained in:
Keader
2020-08-29 11:33:09 -03:00
parent 8a48ece573
commit 4fcd6ddb74
2 changed files with 34 additions and 26 deletions

View File

@@ -1,3 +1,4 @@
-- [Druid] Nurturing Instinct
DELETE FROM `spell_script_names` WHERE `spell_id` IN (-33872, 33872, 33873);
INSERT INTO `spell_script_names` VALUES (-33872, 'spell_dru_nurturing_instinct');
DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_dru_nurturing_instinct';
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
(-33872,'spell_dru_nurturing_instinct');

View File

@@ -1003,6 +1003,36 @@ class spell_dru_nourish : public SpellScript
}
};
// -33872 - Nurturing Instinct
class spell_dru_nurturing_instinct : public AuraScript
{
PrepareAuraScript(spell_dru_nurturing_instinct);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_DRUID_NURTURING_INSTINCT_R1, SPELL_DRUID_NURTURING_INSTINCT_R2 });
}
void AfterApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
{
Unit* target = GetTarget();
uint32 spellId = GetSpellInfo()->GetRank() == 1 ? SPELL_DRUID_NURTURING_INSTINCT_R1 : SPELL_DRUID_NURTURING_INSTINCT_R2;
target->CastSpell(target, spellId, aurEff);
}
void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
uint32 spellId = GetSpellInfo()->GetRank() == 1 ? SPELL_DRUID_NURTURING_INSTINCT_R1 : SPELL_DRUID_NURTURING_INSTINCT_R2;
GetTarget()->RemoveAurasDueToSpell(spellId);
}
void Register() override
{
AfterEffectApply += AuraEffectApplyFn(spell_dru_nurturing_instinct::AfterApply, EFFECT_0, SPELL_AURA_MOD_SPELL_HEALING_OF_STAT_PERCENT, AURA_EFFECT_HANDLE_REAL);
AfterEffectRemove += AuraEffectRemoveFn(spell_dru_nurturing_instinct::AfterRemove, EFFECT_0, SPELL_AURA_MOD_SPELL_HEALING_OF_STAT_PERCENT, AURA_EFFECT_HANDLE_REAL);
}
};
// 16864 - Omen of Clarity
class spell_dru_omen_of_clarity : public AuraScript
{
@@ -1894,29 +1924,6 @@ class spell_dru_wild_growth_aura : public AuraScript
float _baseReduction = 2.f;
};
class spell_dru_nurturing_instinct : public AuraScript
{
PrepareAuraScript(spell_dru_nurturing_instinct);
void AfterApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (Player* player = GetTarget()->ToPlayer())
player->AddAura(GetSpellInfo()->GetRank() == 1 ? SPELL_DRUID_NURTURING_INSTINCT_R1 : SPELL_DRUID_NURTURING_INSTINCT_R2, player);
}
void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (Player* player = GetTarget()->ToPlayer())
player->RemoveAura(GetSpellInfo()->GetRank() == 1 ? SPELL_DRUID_NURTURING_INSTINCT_R1 : SPELL_DRUID_NURTURING_INSTINCT_R2);
}
void Register() override
{
AfterEffectApply += AuraEffectApplyFn(spell_dru_nurturing_instinct::AfterApply, EFFECT_0, SPELL_AURA_MOD_SPELL_HEALING_OF_STAT_PERCENT, AURA_EFFECT_HANDLE_REAL);
AfterEffectRemove += AuraEffectRemoveFn(spell_dru_nurturing_instinct::AfterRemove, EFFECT_0, SPELL_AURA_MOD_SPELL_HEALING_OF_STAT_PERCENT, AURA_EFFECT_HANDLE_REAL);
}
};
void AddSC_druid_spell_scripts()
{
RegisterSpellScript(spell_dru_barkskin);
@@ -1944,6 +1951,7 @@ void AddSC_druid_spell_scripts()
RegisterSpellScript(spell_dru_living_seed_proc);
RegisterSpellScript(spell_dru_moonkin_form_passive);
RegisterSpellScript(spell_dru_nourish);
RegisterSpellScript(spell_dru_nurturing_instinct);
RegisterSpellScript(spell_dru_omen_of_clarity);
RegisterSpellScript(spell_dru_owlkin_frenzy);
RegisterSpellScript(spell_dru_predatory_strikes);
@@ -1968,5 +1976,4 @@ void AddSC_druid_spell_scripts()
RegisterSpellScript(spell_dru_t10_restoration_4p_bonus);
RegisterSpellScript(spell_dru_t10_restoration_4p_bonus_dummy);
RegisterSpellAndAuraScriptPair(spell_dru_wild_growth, spell_dru_wild_growth_aura);
RegisterSpellScript(spell_dru_nurturing_instinct);
}