Core/Spells: Remove redundant explicit target checks from Spell::cast

This commit is contained in:
QAston
2011-09-11 22:42:29 +02:00
parent 606fd07cb1
commit 1d38ccaca6
+2 -16
View File
@@ -3062,26 +3062,12 @@ void Spell::cast(bool skipCheck)
// update pointers base at GUIDs to prevent access to non-existed already object // update pointers base at GUIDs to prevent access to non-existed already object
UpdatePointers(); 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(); cancel();
return; return;
} }
}
// now that we've done the basic check, now run the scripts // now that we've done the basic check, now run the scripts
// should be done before the spell is actually executed // should be done before the spell is actually executed