Core/Spells: Define and implement attributes SPELL_ATTR1_CANT_BE_REDIRECTED and SPELL_ATTR1_CANT_BE_REFLECTED, fixes some problems with Grounding Totem and Spell Reflection.

This commit is contained in:
QAston
2011-07-13 20:14:55 +02:00
parent 7b2cf3d1f2
commit b9413f08b3
5 changed files with 10 additions and 33 deletions
+1 -1
View File
@@ -10157,7 +10157,7 @@ Unit* Unit::SelectMagnetTarget(Unit* victim, SpellEntry const* spellInfo)
if (spellInfo && (spellInfo->DmgClass == SPELL_DAMAGE_CLASS_NONE || spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MAGIC))
{
// Patch 1.2 notes: Spell Reflection no longer reflects abilities
if (spellInfo->Attributes & SPELL_ATTR0_ABILITY)
if (spellInfo->Attributes & SPELL_ATTR0_ABILITY || spellInfo->AttributesEx & SPELL_ATTR1_CANT_BE_REDIRECTED || spellInfo->Attributes & SPELL_ATTR0_UNAFFECTED_BY_INVULNERABILITY)
return victim;
// I am not sure if this should be redirected.
if (spellInfo->DmgClass == SPELL_DAMAGE_CLASS_NONE)
@@ -302,13 +302,13 @@ enum SpellAttr1
SPELL_ATTR1_DISMISS_PET = 0x00000001, // 0 for spells without this flag client doesn't allow to summon pet if caster has a pet
SPELL_ATTR1_DRAIN_ALL_POWER = 0x00000002, // 1 use all power (Only paladin Lay of Hands and Bunyanize)
SPELL_ATTR1_CHANNELED_1 = 0x00000004, // 2 clientside checked? cancelable?
SPELL_ATTR1_PUT_CASTER_IN_COMBAT = 0x00000008, // 3 spells that cause a caster to enter a combat
SPELL_ATTR1_CANT_BE_REDIRECTED = 0x00000008, // 3
SPELL_ATTR1_UNK4 = 0x00000010, // 4 stealth and whirlwind
SPELL_ATTR1_NOT_BREAK_STEALTH = 0x00000020, // 5 Not break stealth
SPELL_ATTR1_CHANNELED_2 = 0x00000040, // 6
SPELL_ATTR1_NEGATIVE = 0x00000080, // 7
SPELL_ATTR1_CANT_BE_REFLECTED = 0x00000080, // 7
SPELL_ATTR1_NOT_IN_COMBAT_TARGET = 0x00000100, // 8 Spell req target not to be in combat state
SPELL_ATTR1_MELEE_COMBAT_SPELL = 0x00000200, // 9 player starts melee combat after this spell is cast
SPELL_ATTR1_MELEE_COMBAT_START = 0x00000200, // 9 player starts melee combat after this spell is cast
SPELL_ATTR1_NO_THREAT = 0x00000400, // 10 no generates threat on cast 100% (old NO_INITIAL_AGGRO)
SPELL_ATTR1_UNK11 = 0x00000800, // 11 aura
SPELL_ATTR1_UNK12 = 0x00001000, // 12
@@ -337,7 +337,7 @@ enum SpellAttr2
{
SPELL_ATTR2_ALLOW_DEAD_TARGET = 0x00000001, // 0
SPELL_ATTR2_UNK1 = 0x00000002, // 1 ? many triggered spells have this flag
SPELL_ATTR2_CANT_REFLECTED = 0x00000004, // 2 ? used for detect can or not spell reflected
SPELL_ATTR2_UNK2 = 0x00000004, // 2
SPELL_ATTR2_UNK3 = 0x00000008, // 3
SPELL_ATTR2_ALWAYS_APPLY_MODIFIERS = 0x00000010, // 4 ? spell modifiers are applied dynamically (even if aura is not passive)
SPELL_ATTR2_AUTOREPEAT_FLAG = 0x00000020, // 5
+4 -21
View File
@@ -526,28 +526,11 @@ m_caster(Caster), m_spellValue(new SpellValue(m_spellInfo))
m_channelTargetEffectMask = 0;
// determine reflection
m_canReflect = false;
// Determine if spell can be reflected back to the caster
// Patch 1.2 notes: Spell Reflection no longer reflects abilities
if (m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MAGIC && !IsAreaOfEffectSpell(m_spellInfo) && !(m_spellInfo->AttributesEx2 & SPELL_ATTR2_CANT_REFLECTED) && !(m_spellInfo->Attributes & SPELL_ATTR0_ABILITY))
{
for (int j = 0; j < MAX_SPELL_EFFECTS; ++j)
{
if (m_spellInfo->Effect[j] == 0)
continue;
if (!IsPositiveTarget(m_spellInfo->EffectImplicitTargetA[j], m_spellInfo->EffectImplicitTargetB[j]))
m_canReflect = true;
else
m_canReflect = (m_spellInfo->AttributesEx & SPELL_ATTR1_NEGATIVE) ? true : false;
if (m_canReflect)
continue;
else
break;
}
}
m_canReflect = m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MAGIC && !(m_spellInfo->Attributes & SPELL_ATTR0_ABILITY)
&& !(m_spellInfo->AttributesEx & SPELL_ATTR1_CANT_BE_REFLECTED) && !(m_spellInfo->Attributes & SPELL_ATTR0_UNAFFECTED_BY_INVULNERABILITY)
&& !IsPassiveSpell(m_spellInfo) && !IsPositiveSpell(m_spellInfo->Id);
CleanupTargetList();
CleanupEffectExecuteData();
+1 -3
View File
@@ -3171,11 +3171,9 @@ void Spell::EffectDispel(SpellEffIndex effIndex)
{
if (aura->GetSpellProto()->Dispel == DISPEL_MAGIC)
{
bool positive = aurApp->IsPositive() ? (!(aura->GetSpellProto()->AttributesEx & SPELL_ATTR1_NEGATIVE)) : false;
// do not remove positive auras if friendly target
// negative auras if non-friendly target
if (positive == unitTarget->IsFriendlyTo(m_caster))
if (aurApp->IsPositive() == unitTarget->IsFriendlyTo(m_caster))
continue;
}
-4
View File
@@ -988,10 +988,6 @@ bool SpellMgr::_isPositiveEffect(uint32 spellId, uint32 effIndex, bool deep) con
if (!IsPositiveTarget(spellproto->EffectImplicitTargetA[effIndex], spellproto->EffectImplicitTargetB[effIndex]))
return false;
// AttributesEx check
if (spellproto->AttributesEx & SPELL_ATTR1_NEGATIVE)
return false;
if (!deep && spellproto->EffectTriggerSpell[effIndex]
&& !spellproto->EffectApplyAuraName[effIndex]
&& IsPositiveTarget(spellproto->EffectImplicitTargetA[effIndex], spellproto->EffectImplicitTargetB[effIndex])