fix(Core/Spells): Do not apply diminishing return on spells casted by mobs. (#9536)

Fixes #9028
This commit is contained in:
UltraNix
2021-12-14 19:17:44 +01:00
committed by GitHub
parent de0672e9d8
commit 658a7c2b56
2 changed files with 12 additions and 7 deletions

View File

@@ -2879,10 +2879,15 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit* unit, uint32 effectMask, bool scaleA
uint32 flagsExtra = unit->GetTypeId() == TYPEID_UNIT ? unit->ToCreature()->GetCreatureTemplate()->flags_extra : 0;
// Increase Diminishing on unit, current informations for actually casts will use values above
if ((type == DRTYPE_PLAYER && (
unit->GetCharmerOrOwnerPlayerOrPlayerItself() || flagsExtra & CREATURE_FLAG_EXTRA_ALL_DIMINISH || (m_diminishGroup == DIMINISHING_TAUNT && (flagsExtra & CREATURE_FLAG_EXTRA_OBEYS_TAUNT_DIMINISHING_RETURNS))
)) || type == DRTYPE_ALL)
unit->IncrDiminishing(m_diminishGroup);
if ((type == DRTYPE_PLAYER && (unit->IsCharmedOwnedByPlayerOrPlayer() || flagsExtra & CREATURE_FLAG_EXTRA_ALL_DIMINISH ||
(m_diminishGroup == DIMINISHING_TAUNT && (flagsExtra & CREATURE_FLAG_EXTRA_OBEYS_TAUNT_DIMINISHING_RETURNS)))) || type == DRTYPE_ALL)
{
// Do not apply diminish return if caster is NPC
if (m_caster->IsCharmedOwnedByPlayerOrPlayer())
{
unit->IncrDiminishing(m_diminishGroup);
}
}
}
if (m_caster != unit && m_caster->IsHostileTo(unit) && !m_spellInfo->IsPositive() && !m_triggeredByAuraSpell && !m_spellInfo->HasAttribute(SPELL_ATTR0_CU_DONT_BREAK_STEALTH))