[10075] Attempt use more expected by result buffs downranking algo.

* In small rate more fast
* Not affect non-buff ranked spells like 10909
This commit is contained in:
VladimirMangos 2010-06-18 04:03:08 +04:00
parent 07a931e141
commit 81851074ad
6 changed files with 45 additions and 31 deletions

View file

@ -4253,21 +4253,11 @@ SpellCastResult Spell::CheckCast(bool strict)
// auto selection spell rank implemented in WorldSession::HandleCastSpellOpcode
// this case can be triggered if rank not found (too low-level target for first rank)
if (m_caster->GetTypeId() == TYPEID_PLAYER && !IsPassiveSpell(m_spellInfo) && !m_CastItem)
if (m_caster->GetTypeId() == TYPEID_PLAYER && !m_CastItem && !m_IsTriggeredSpell)
{
for(int i = 0; i < MAX_EFFECT_INDEX; ++i)
{
// check only spell that apply positive auras
if (m_spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AURA &&
IsPositiveEffect(m_spellInfo->Id, SpellEffectIndex(i)) &&
// at not self target
!IsCasterSourceTarget(m_spellInfo->EffectImplicitTargetA[i]) &&
// and target low level
target->getLevel() + 10 < m_spellInfo->spellLevel)
{
return SPELL_FAILED_LOWLEVEL;
}
}
// spell expected to be auto-downranking in cast handle, so must be same
if (m_spellInfo != sSpellMgr.SelectAuraRankForLevel(m_spellInfo, target->getLevel()))
return SPELL_FAILED_LOWLEVEL;
}
}
else if (m_caster == target)