mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-19 17:05:44 +01:00
Core/Spells: Diminishing returns shouldn't prevent direct damage caused by spells - fixes dispel damage of Unstable Affliction if target immune to silence now
This commit is contained in:
@@ -1449,7 +1449,7 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask, bool
|
||||
|
||||
uint8 aura_effmask = 0;
|
||||
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
|
||||
if (effectMask & (1 <<i ) && m_spellInfo->Effects[i].IsUnitOwnedAuraEffect())
|
||||
if (effectMask & (1 << i ) && m_spellInfo->Effects[i].IsUnitOwnedAuraEffect())
|
||||
aura_effmask |= 1 << i;
|
||||
|
||||
if (aura_effmask)
|
||||
@@ -1498,34 +1498,41 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask, bool
|
||||
if (diminishMod == 0.0f)
|
||||
{
|
||||
m_spellAura->Remove();
|
||||
return SPELL_MISS_IMMUNE;
|
||||
bool found = false;
|
||||
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
|
||||
if (effectMask & (1 << i) && m_spellInfo->Effects[i].Effect != SPELL_EFFECT_APPLY_AURA)
|
||||
found = true;
|
||||
if (!found)
|
||||
return SPELL_MISS_IMMUNE;
|
||||
}
|
||||
|
||||
((UnitAura*)m_spellAura)->SetDiminishGroup(m_diminishGroup);
|
||||
|
||||
bool positive = m_spellAura->GetSpellInfo()->IsPositive();
|
||||
AuraApplication * aurApp = m_spellAura->GetApplicationOfTarget(m_originalCaster->GetGUID());
|
||||
if (aurApp)
|
||||
positive = aurApp->IsPositive();
|
||||
|
||||
duration = m_originalCaster->ModSpellDuration(aurSpellInfo, unit, duration, positive);
|
||||
|
||||
// Haste modifies duration of channeled spells
|
||||
if (m_spellInfo->IsChanneled())
|
||||
else
|
||||
{
|
||||
if (m_spellInfo->AttributesEx5 & SPELL_ATTR5_HASTE_AFFECT_DURATION)
|
||||
m_originalCaster->ModSpellCastTime(aurSpellInfo, duration, this);
|
||||
}
|
||||
// and duration of auras affected by SPELL_AURA_PERIODIC_HASTE
|
||||
else if (m_originalCaster->HasAuraTypeWithAffectMask(SPELL_AURA_PERIODIC_HASTE, aurSpellInfo) || m_spellInfo->AttributesEx5 & SPELL_ATTR5_HASTE_AFFECT_DURATION)
|
||||
duration = int32(duration * m_originalCaster->GetFloatValue(UNIT_MOD_CAST_SPEED));
|
||||
((UnitAura*)m_spellAura)->SetDiminishGroup(m_diminishGroup);
|
||||
|
||||
if (duration != m_spellAura->GetMaxDuration())
|
||||
{
|
||||
m_spellAura->SetMaxDuration(duration);
|
||||
m_spellAura->SetDuration(duration);
|
||||
bool positive = m_spellAura->GetSpellInfo()->IsPositive();
|
||||
AuraApplication* aurApp = m_spellAura->GetApplicationOfTarget(m_originalCaster->GetGUID());
|
||||
if (aurApp)
|
||||
positive = aurApp->IsPositive();
|
||||
|
||||
duration = m_originalCaster->ModSpellDuration(aurSpellInfo, unit, duration, positive);
|
||||
|
||||
// Haste modifies duration of channeled spells
|
||||
if (m_spellInfo->IsChanneled())
|
||||
{
|
||||
if (m_spellInfo->AttributesEx5 & SPELL_ATTR5_HASTE_AFFECT_DURATION)
|
||||
m_originalCaster->ModSpellCastTime(aurSpellInfo, duration, this);
|
||||
}
|
||||
// and duration of auras affected by SPELL_AURA_PERIODIC_HASTE
|
||||
else if (m_originalCaster->HasAuraTypeWithAffectMask(SPELL_AURA_PERIODIC_HASTE, aurSpellInfo) || m_spellInfo->AttributesEx5 & SPELL_ATTR5_HASTE_AFFECT_DURATION)
|
||||
duration = int32(duration * m_originalCaster->GetFloatValue(UNIT_MOD_CAST_SPEED));
|
||||
|
||||
if (duration != m_spellAura->GetMaxDuration())
|
||||
{
|
||||
m_spellAura->SetMaxDuration(duration);
|
||||
m_spellAura->SetDuration(duration);
|
||||
}
|
||||
m_spellAura->_RegisterForTargets();
|
||||
}
|
||||
m_spellAura->_RegisterForTargets();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user