Core/Spells: Remove redundant explicit target checks from Spell::cast
This commit is contained in:
@@ -3062,25 +3062,11 @@ void Spell::cast(bool skipCheck)
|
||||
// update pointers base at GUIDs to prevent access to non-existed already object
|
||||
UpdatePointers();
|
||||
|
||||
if (Unit* target = m_targets.GetUnitTarget())
|
||||
// cancel at lost explicit target during cast
|
||||
if (m_targets.GetObjectTargetGUID() && !m_targets.GetObjectTarget())
|
||||
{
|
||||
// three check: prepare, cast (m_casttime > 0), hit (delayed)
|
||||
if (m_casttime && target->isAlive() && !target->IsFriendlyTo(m_caster) && !m_caster->canSeeOrDetect(target))
|
||||
{
|
||||
SendCastResult(SPELL_FAILED_BAD_TARGETS);
|
||||
SendInterrupted(0);
|
||||
finish(false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// cancel at lost main target unit
|
||||
if (m_targets.GetUnitTargetGUID() && m_targets.GetUnitTargetGUID() != m_caster->GetGUID())
|
||||
{
|
||||
cancel();
|
||||
return;
|
||||
}
|
||||
cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
// now that we've done the basic check, now run the scripts
|
||||
|
||||
Reference in New Issue
Block a user