Core/Spell: check aura positivity per effect on spell hit
Port From (https://github.com/TrinityCore/TrinityCore/commit/f31e380499b9ecceca9e86b1ee55eb29c7f87c88)
This commit is contained in:
@@ -2681,11 +2681,11 @@ namespace Game.Entities
|
|||||||
++diminish.HitCount;
|
++diminish.HitCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float ApplyDiminishingToDuration(SpellInfo auraSpellInfo, ref int duration, Unit caster, DiminishingLevels previousLevel)
|
public bool ApplyDiminishingToDuration(SpellInfo auraSpellInfo, ref int duration, Unit caster, DiminishingLevels previousLevel)
|
||||||
{
|
{
|
||||||
DiminishingGroup group = auraSpellInfo.GetDiminishingReturnsGroupForSpell();
|
DiminishingGroup group = auraSpellInfo.GetDiminishingReturnsGroupForSpell();
|
||||||
if (duration == -1 || group == DiminishingGroup.None)
|
if (duration == -1 || group == DiminishingGroup.None)
|
||||||
return 1.0f;
|
return true;
|
||||||
|
|
||||||
int limitDuration = auraSpellInfo.GetDiminishingReturnsLimitDuration();
|
int limitDuration = auraSpellInfo.GetDiminishingReturnsLimitDuration();
|
||||||
|
|
||||||
@@ -2704,7 +2704,6 @@ namespace Game.Entities
|
|||||||
}
|
}
|
||||||
|
|
||||||
float mod = 1.0f;
|
float mod = 1.0f;
|
||||||
|
|
||||||
switch (group)
|
switch (group)
|
||||||
{
|
{
|
||||||
case DiminishingGroup.Taunt:
|
case DiminishingGroup.Taunt:
|
||||||
@@ -2776,7 +2775,7 @@ namespace Game.Entities
|
|||||||
}
|
}
|
||||||
|
|
||||||
duration = (int)(duration * mod);
|
duration = (int)(duration * mod);
|
||||||
return mod;
|
return duration != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ApplyDiminishingAura(DiminishingGroup group, bool apply)
|
public void ApplyDiminishingAura(DiminishingGroup group, bool apply)
|
||||||
|
|||||||
@@ -2096,11 +2096,24 @@ namespace Game.Spells
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Now Reduce spell duration using data received at spell hit
|
// Now Reduce spell duration using data received at spell hit
|
||||||
|
// check whatever effects we're going to apply, diminishing returns only apply to negative aura effects
|
||||||
|
bool positive = true;
|
||||||
|
if (m_originalCaster == unit || !m_originalCaster.IsFriendlyTo(unit))
|
||||||
|
{
|
||||||
|
for (uint i = 0; i < SpellConst.MaxEffects; ++i)
|
||||||
|
{
|
||||||
|
if ((effectMask & (1 << (int)i)) != 0 && !m_spellInfo.IsPositiveEffect(i))
|
||||||
|
{
|
||||||
|
positive = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int duration = m_spellAura.GetMaxDuration();
|
int duration = m_spellAura.GetMaxDuration();
|
||||||
float diminishMod = unit.ApplyDiminishingToDuration(m_spellInfo, ref duration, m_originalCaster, diminishLevel);
|
|
||||||
|
|
||||||
// unit is immune to aura if it was diminished to 0 duration
|
// unit is immune to aura if it was diminished to 0 duration
|
||||||
if (diminishMod == 0.0f)
|
if (!positive && !unit.ApplyDiminishingToDuration(m_spellInfo, ref duration, m_originalCaster, diminishLevel))
|
||||||
{
|
{
|
||||||
m_spellAura.Remove();
|
m_spellAura.Remove();
|
||||||
bool found = false;
|
bool found = false;
|
||||||
@@ -2114,13 +2127,7 @@ namespace Game.Spells
|
|||||||
{
|
{
|
||||||
((UnitAura)m_spellAura).SetDiminishGroup(diminishGroup);
|
((UnitAura)m_spellAura).SetDiminishGroup(diminishGroup);
|
||||||
|
|
||||||
bool positive = m_spellAura.GetSpellInfo().IsPositive();
|
|
||||||
AuraApplication aurApp = m_spellAura.GetApplicationOfTarget(m_originalCaster.GetGUID());
|
|
||||||
if (aurApp != null)
|
|
||||||
positive = aurApp.IsPositive();
|
|
||||||
|
|
||||||
duration = m_originalCaster.ModSpellDuration(m_spellInfo, unit, duration, positive, effectMask);
|
duration = m_originalCaster.ModSpellDuration(m_spellInfo, unit, duration, positive, effectMask);
|
||||||
|
|
||||||
if (duration > 0)
|
if (duration > 0)
|
||||||
{
|
{
|
||||||
// Haste modifies duration of channeled spells
|
// Haste modifies duration of channeled spells
|
||||||
|
|||||||
Reference in New Issue
Block a user