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()
|
void Register()
|
||||||
{
|
{
|
||||||
// add dummy effect spell handler to Holy Shock
|
// 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);
|
OnEffectHitTarget += SpellEffectFn(spell_pal_holy_shock_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user