diff --git a/data/sql/updates/pending_db_world/bop-ally.sql b/data/sql/updates/pending_db_world/bop-ally.sql new file mode 100644 index 000000000..55ef4c95a --- /dev/null +++ b/data/sql/updates/pending_db_world/bop-ally.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_script_names` WHERE `spell_id` = -1022; +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(-1022, 'spell_pal_hand_of_protection'); diff --git a/src/server/scripts/Spells/spell_paladin.cpp b/src/server/scripts/Spells/spell_paladin.cpp index e2350a2c8..941af7f4f 100644 --- a/src/server/scripts/Spells/spell_paladin.cpp +++ b/src/server/scripts/Spells/spell_paladin.cpp @@ -1150,6 +1150,36 @@ class spell_pal_seal_of_vengeance : public SpellScript } }; +// 1022 - Hand of Protection +class spell_pal_hand_of_protection : public SpellScript +{ + PrepareSpellScript(spell_pal_hand_of_protection); + + SpellCastResult CheckCast() + { + Unit* caster = GetCaster(); + + if (!caster->GetTarget() || caster->GetTarget() == caster->GetGUID()) + return SPELL_CAST_OK; + + if (caster->HasStunAura()) + return SPELL_FAILED_STUNNED; + + if (caster->HasConfuseAura()) + return SPELL_FAILED_CONFUSED; + + if (caster->GetUnitFlags() & UNIT_FLAG_FLEEING) + return SPELL_FAILED_FLEEING; + + return SPELL_CAST_OK; + } + + void Register() override + { + OnCheckCast += SpellCheckCastFn(spell_pal_hand_of_protection::CheckCast); + } +}; + void AddSC_paladin_spell_scripts() { RegisterSpellAndAuraScriptPair(spell_pal_seal_of_command, spell_pal_seal_of_command_aura); @@ -1178,4 +1208,5 @@ void AddSC_paladin_spell_scripts() RegisterSpellScript(spell_pal_righteous_defense); RegisterSpellScript(spell_pal_seal_of_righteousness); RegisterSpellScript(spell_pal_seal_of_vengeance); + RegisterSpellScript(spell_pal_hand_of_protection); }