mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-22 10:05:32 +01:00
Core/Spells: fix holy shock cast on friendly opposing team going on cooldown and saying invalid target. spell will now fail with invalid target and not cause a cooldown
This commit is contained in:
@@ -285,9 +285,20 @@ class spell_pal_holy_shock : public SpellScriptLoader
|
||||
}
|
||||
}
|
||||
|
||||
SpellCastResult CheckCast()
|
||||
{
|
||||
Player* caster = GetCaster()->ToPlayer();
|
||||
if (GetTargetUnit())
|
||||
if (Player* target = GetTargetUnit()->ToPlayer())
|
||||
if (caster->GetTeam() != target->GetTeam() && !caster->IsValidAttackTarget(target))
|
||||
return SPELL_FAILED_BAD_TARGETS;
|
||||
return SPELL_CAST_OK;
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
// add dummy effect spell handler to Holy Shock
|
||||
OnCheckCast += SpellCheckCastFn(spell_pal_holy_shock_SpellScript::CheckCast);
|
||||
OnEffectHitTarget += SpellEffectFn(spell_pal_holy_shock_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user