Core/Spells: implemented SPELL_ATTR0_CU_TRIGGERED_BY_CASTER to correct some triggered spells, which will wrongly triggered by target instead of caster

Closes #1972
This commit is contained in:
joschiwald
2013-08-14 18:22:28 +02:00
parent 73be61bb83
commit 73f7c1118d
3 changed files with 15 additions and 7 deletions

View File

@@ -1006,8 +1006,12 @@ bool SpellInfo::NeedsExplicitUnitTarget() const
bool SpellInfo::NeedsToBeTriggeredByCaster() const
{
if (AttributesCu & SPELL_ATTR0_CU_TRIGGERED_BY_CASTER)
return true;
if (NeedsExplicitUnitTarget())
return true;
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
if (Effects[i].IsEffect())
@@ -1017,6 +1021,7 @@ bool SpellInfo::NeedsToBeTriggeredByCaster() const
return true;
}
}
return false;
}
@@ -1714,7 +1719,7 @@ uint32 SpellInfo::GetAllEffectsMechanicMask() const
uint32 mask = 0;
if (Mechanic)
mask |= 1 << Mechanic;
for (int i = 0; i < MAX_SPELL_EFFECTS; ++i)
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
if (Effects[i].IsEffect() && Effects[i].Mechanic)
mask |= 1 << Effects[i].Mechanic;
return mask;
@@ -1724,9 +1729,9 @@ uint32 SpellInfo::GetEffectMechanicMask(uint8 effIndex) const
{
uint32 mask = 0;
if (Mechanic)
mask |= 1<< Mechanic;
mask |= 1 << Mechanic;
if (Effects[effIndex].IsEffect() && Effects[effIndex].Mechanic)
mask |= 1<< Effects[effIndex].Mechanic;
mask |= 1 << Effects[effIndex].Mechanic;
return mask;
}
@@ -1734,10 +1739,10 @@ uint32 SpellInfo::GetSpellMechanicMaskByEffectMask(uint32 effectMask) const
{
uint32 mask = 0;
if (Mechanic)
mask |= 1<< Mechanic;
for (int i = 0; i < MAX_SPELL_EFFECTS; ++i)
mask |= 1 << Mechanic;
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
if ((effectMask & (1 << i)) && Effects[i].Mechanic)
mask |= 1<< Effects[i].Mechanic;
mask |= 1 << Effects[i].Mechanic;
return mask;
}

View File

@@ -176,7 +176,7 @@ enum SpellCustomAttributes
SPELL_ATTR0_CU_CONE_LINE = 0x00000004,
SPELL_ATTR0_CU_SHARE_DAMAGE = 0x00000008,
SPELL_ATTR0_CU_NO_INITIAL_THREAT = 0x00000010,
SPELL_ATTR0_CU_NONE2 = 0x00000020, // UNUSED
SPELL_ATTR0_CU_TRIGGERED_BY_CASTER = 0x00000020, // @todo: need generic solution, some triggered spells will be casted by target instead of caster
SPELL_ATTR0_CU_AURA_CC = 0x00000040,
SPELL_ATTR0_CU_DIRECT_DAMAGE = 0x00000100,
SPELL_ATTR0_CU_CHARGE = 0x00000200,

View File

@@ -2972,6 +2972,9 @@ void SpellMgr::LoadSpellInfoCustomAttributes()
case 72293: // Mark of the Fallen Champion (Deathbringer Saurfang)
spellInfo->AttributesCu |= SPELL_ATTR0_CU_NEGATIVE_EFF0;
break;
case 38729: // Rod of Purification
spellInfo->AttributesCu |= SPELL_ATTR0_CU_TRIGGERED_BY_CASTER;
break;
default:
break;
}