[11288] Check IsPositiveEffect in IsPositiveSpell only for existed effects.

Thanks to NoFantasy for problem research.

Also make IsPositiveEffect use SpellEntry* arg instead spell id.
This commit is contained in:
VladimirMangos 2011-03-26 03:05:48 +03:00
parent dae28ae93a
commit 989d229968
9 changed files with 24 additions and 21 deletions

View file

@ -623,17 +623,13 @@ bool IsExplicitNegativeTarget(uint32 targetA)
return false;
}
bool IsPositiveEffect(uint32 spellId, SpellEffectIndex effIndex)
bool IsPositiveEffect(SpellEntry const *spellproto, SpellEffectIndex effIndex)
{
SpellEntry const *spellproto = sSpellStore.LookupEntry(spellId);
if (!spellproto)
return false;
switch(spellproto->Effect[effIndex])
{
case SPELL_EFFECT_DUMMY:
// some explicitly required dummy effect sets
switch(spellId)
switch(spellproto->Id)
{
case 28441: // AB Effect 000
return false;
@ -708,7 +704,7 @@ bool IsPositiveEffect(uint32 spellId, SpellEffectIndex effIndex)
case SPELL_AURA_ADD_TARGET_TRIGGER:
return true;
case SPELL_AURA_PERIODIC_TRIGGER_SPELL:
if (spellId != spellproto->EffectTriggerSpell[effIndex])
if (spellproto->Id != spellproto->EffectTriggerSpell[effIndex])
{
uint32 spellTriggeredId = spellproto->EffectTriggerSpell[effIndex];
SpellEntry const *spellTriggeredProto = sSpellStore.LookupEntry(spellTriggeredId);
@ -720,8 +716,8 @@ bool IsPositiveEffect(uint32 spellId, SpellEffectIndex effIndex)
{
// if non-positive trigger cast targeted to positive target this main cast is non-positive
// this will place this spell auras as debuffs
if (IsPositiveTarget(spellTriggeredProto->EffectImplicitTargetA[effIndex],spellTriggeredProto->EffectImplicitTargetB[effIndex]) &&
!IsPositiveEffect(spellTriggeredId,SpellEffectIndex(i)))
if (IsPositiveTarget(spellTriggeredProto->EffectImplicitTargetA[effIndex], spellTriggeredProto->EffectImplicitTargetB[effIndex]) &&
!IsPositiveEffect(spellTriggeredProto, SpellEffectIndex(i)))
return false;
}
}
@ -854,7 +850,7 @@ bool IsPositiveSpell(uint32 spellId)
// spells with at least one negative effect are considered negative
// some self-applied spells have negative effects but in self casting case negative check ignored.
for (int i = 0; i < MAX_EFFECT_INDEX; ++i)
if (!IsPositiveEffect(spellId, SpellEffectIndex(i)))
if (spellproto->Effect[i] && !IsPositiveEffect(spellproto, SpellEffectIndex(i)))
return false;
return true;
}
@ -2405,7 +2401,7 @@ SpellEntry const* SpellMgr::SelectAuraRankForLevel(SpellEntry const* spellInfo,
IsAreaEffectPossitiveTarget(Targets(spellInfo->EffectImplicitTargetA[i])))) ||
spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AREA_AURA_PARTY ||
spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AREA_AURA_RAID) &&
IsPositiveEffect(spellInfo->Id, SpellEffectIndex(i)))
IsPositiveEffect(spellInfo, SpellEffectIndex(i)))
{
needRankSelection = true;
break;