[8346] Avoid aggro at positive spells for non friendly targets.

* Not all positive spell have SPELL_ATTR_EX_NO_INITIAL_AGGRO (for react at assistance).
  Avoid aggro at positive spell without this flag for non frindly target.
* Some cleanups and better checks in IsPositiveEffect.
This commit is contained in:
VladimirMangos 2009-08-11 01:19:38 +04:00
parent dddacab0dd
commit 99f74411a0
3 changed files with 27 additions and 23 deletions

View file

@ -1205,7 +1205,7 @@ void Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask)
unit->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); unit->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH);
// can cause back attack (if detected) // can cause back attack (if detected)
if (!(m_spellInfo->AttributesEx & SPELL_ATTR_EX_NO_INITIAL_AGGRO) && if (!(m_spellInfo->AttributesEx & SPELL_ATTR_EX_NO_INITIAL_AGGRO) && !IsPositiveSpell(m_spellInfo->Id) &&
m_caster->isVisibleForOrDetect(unit,false)) // stealth removed at Spell::cast if spell break it m_caster->isVisibleForOrDetect(unit,false)) // stealth removed at Spell::cast if spell break it
{ {
// use speedup check to avoid re-remove after above lines // use speedup check to avoid re-remove after above lines
@ -2783,12 +2783,16 @@ void Spell::finish(bool ok)
// Not drop combopoints if negative spell and if any miss on enemy exist // Not drop combopoints if negative spell and if any miss on enemy exist
bool needDrop = true; bool needDrop = true;
if (!IsPositiveSpell(m_spellInfo->Id)) if (!IsPositiveSpell(m_spellInfo->Id))
{
for(std::list<TargetInfo>::const_iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit) for(std::list<TargetInfo>::const_iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit)
{
if (ihit->missCondition != SPELL_MISS_NONE && ihit->targetGUID!=m_caster->GetGUID()) if (ihit->missCondition != SPELL_MISS_NONE && ihit->targetGUID!=m_caster->GetGUID())
{ {
needDrop = false; needDrop = false;
break; break;
} }
}
}
if (needDrop) if (needDrop)
((Player*)m_caster)->ClearComboPoints(); ((Player*)m_caster)->ClearComboPoints();
} }

View file

@ -301,15 +301,17 @@ bool IsPositiveEffect(uint32 spellId, uint32 effIndex)
SpellEntry const *spellproto = sSpellStore.LookupEntry(spellId); SpellEntry const *spellproto = sSpellStore.LookupEntry(spellId);
if (!spellproto) return false; if (!spellproto) return false;
switch(spellId)
{
case 28441: // not positive dummy spell
case 37675: // Chaos Blast
return false;
}
switch(spellproto->Effect[effIndex]) switch(spellproto->Effect[effIndex])
{ {
case SPELL_EFFECT_DUMMY:
// some explicitly required dummy effect sets
switch(spellId)
{
case 28441: return false; // AB Effect 000
default:
break;
}
break;
// always positive effects (check before target checks that provided non-positive result in some case for positive effects) // always positive effects (check before target checks that provided non-positive result in some case for positive effects)
case SPELL_EFFECT_HEAL: case SPELL_EFFECT_HEAL:
case SPELL_EFFECT_LEARN_SPELL: case SPELL_EFFECT_LEARN_SPELL:
@ -349,15 +351,21 @@ bool IsPositiveEffect(uint32 spellId, uint32 effIndex)
break; break;
} }
} break; } break;
case SPELL_AURA_MOD_STAT:
case SPELL_AURA_MOD_DAMAGE_DONE: // dependent from bas point sign (negative -> negative) case SPELL_AURA_MOD_DAMAGE_DONE: // dependent from bas point sign (negative -> negative)
case SPELL_AURA_MOD_STAT:
case SPELL_AURA_MOD_SKILL:
case SPELL_AURA_MOD_HEALING_PCT:
case SPELL_AURA_MOD_HEALING_DONE: case SPELL_AURA_MOD_HEALING_DONE:
if(spellproto->CalculateSimpleValue(effIndex) < 0) if(spellproto->CalculateSimpleValue(effIndex) < 0)
return false; return false;
break; break;
case SPELL_AURA_MOD_DAMAGE_TAKEN: // dependent from bas point sign (positive -> negative)
if(spellproto->CalculateSimpleValue(effIndex) > 0)
return false;
break;
case SPELL_AURA_MOD_SPELL_CRIT_CHANCE: case SPELL_AURA_MOD_SPELL_CRIT_CHANCE:
if(spellproto->CalculateSimpleValue(effIndex) > 0) if(spellproto->CalculateSimpleValue(effIndex) > 0)
return true; // some expected possitive spells have SPELL_ATTR_EX_NEGATIVE return true; // some expected positive spells have SPELL_ATTR_EX_NEGATIVE
break; break;
case SPELL_AURA_ADD_TARGET_TRIGGER: case SPELL_AURA_ADD_TARGET_TRIGGER:
return true; return true;
@ -460,14 +468,6 @@ bool IsPositiveEffect(uint32 spellId, uint32 effIndex)
break; break;
} }
} break; } break;
case SPELL_AURA_MOD_HEALING_PCT:
if(spellproto->CalculateSimpleValue(effIndex) < 0)
return false;
break;
case SPELL_AURA_MOD_SKILL:
if(spellproto->CalculateSimpleValue(effIndex) < 0)
return false;
break;
case SPELL_AURA_FORCE_REACTION: case SPELL_AURA_FORCE_REACTION:
if(spellproto->Id==42792) // Recently Dropped Flag (prevent cancel) if(spellproto->Id==42792) // Recently Dropped Flag (prevent cancel)
return false; return false;

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "8345" #define REVISION_NR "8346"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__