Core/Spell: move conditions check to Spell::CheckCast.

This commit is contained in:
QAston
2012-02-09 18:35:52 +01:00
parent 0b1da6c0ad
commit b4022acdf3
+8 -14
View File
@@ -2859,20 +2859,6 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect const* triggered
InitExplicitTargets(*targets);
if (Player* plrCaster = m_caster->GetCharmerOrOwnerPlayerOrPlayerItself())
{
//check for special spell conditions
ConditionList conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_SPELL, m_spellInfo->Id);
if (!conditions.empty())
if (!sConditionMgr->IsPlayerMeetToConditions(plrCaster, conditions))
{
//SendCastResult(SPELL_FAILED_DONT_REPORT);
SendCastResult(plrCaster, m_spellInfo, m_cast_count, SPELL_FAILED_DONT_REPORT);
finish(false);
return;
}
}
// Fill aura scaling information
if (m_caster->IsControlledByPlayer() && !m_spellInfo->IsPassive() && m_spellInfo->SpellLevel && !m_spellInfo->IsChanneled() && !(_triggeredCastFlags & TRIGGERED_IGNORE_AURA_SCALING))
{
@@ -4730,6 +4716,14 @@ SpellCastResult Spell::CheckCast(bool strict)
return SPELL_FAILED_DONT_REPORT;
}
// check spell caster's conditions from database
if (Player* plrCaster = m_caster->GetCharmerOrOwnerPlayerOrPlayerItself())
{
ConditionList conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_SPELL, m_spellInfo->Id);
if (!conditions.empty() && !sConditionMgr->IsPlayerMeetToConditions(plrCaster, conditions))
return SPELL_FAILED_DONT_REPORT;
}
// Don't check explicit target for passive spells (workaround) (check should be skipped only for learn case)
// those spells may have incorrect target entries or not filled at all (for example 15332)
// such spells when learned are not targeting anyone using targeting system, they should apply directly to caster instead