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:
Kandera
2012-04-17 11:45:26 -04:00
parent 17d87c0103
commit 839abe4dca

View File

@@ -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);
}
};