Core/Spell: apply SPELLFAMILY_GENERIC mods to all spells by default

This commit is contained in:
hondacrx
2017-12-11 11:05:01 -05:00
parent 74950e0d66
commit 3760bfcdbb
3 changed files with 23 additions and 20 deletions
+4 -7
View File
@@ -587,15 +587,12 @@ namespace Game.Spells
{ {
if (spell == null) if (spell == null)
return false; return false;
// Check family name
if (spell.SpellFamilyName != m_spellInfo.SpellFamilyName) // Check family name and EffectClassMask
if (!spell.IsAffected(m_spellInfo.SpellFamilyName, GetSpellEffectInfo().SpellClassMask))
return false; return false;
// Check EffectClassMask return true;
if (GetSpellEffectInfo().SpellClassMask & spell.SpellFamilyFlags)
return true;
return false;
} }
void SendTickImmune(Unit target, Unit caster) void SendTickImmune(Unit target, Unit caster)
+16 -7
View File
@@ -597,6 +597,20 @@ namespace Game.Spells
return !(HasAttribute(SpellAttr1.NoThreat) || HasAttribute(SpellAttr3.NoInitialAggro)); return !(HasAttribute(SpellAttr1.NoThreat) || HasAttribute(SpellAttr3.NoInitialAggro));
} }
public bool IsAffected(SpellFamilyNames familyName, FlagArray128 familyFlags)
{
if (familyName == 0)
return true;
if (familyName != SpellFamilyName)
return false;
if (familyFlags && !(familyFlags & SpellFamilyFlags))
return false;
return true;
}
bool IsAffectedBySpellMods() bool IsAffectedBySpellMods()
{ {
return !HasAttribute(SpellAttr3.NoDoneBonus); return !HasAttribute(SpellAttr3.NoDoneBonus);
@@ -608,15 +622,10 @@ namespace Game.Spells
return false; return false;
SpellInfo affectSpell = Global.SpellMgr.GetSpellInfo(mod.spellId); SpellInfo affectSpell = Global.SpellMgr.GetSpellInfo(mod.spellId);
// False if affect_spell == NULL or spellFamily not equal if (affectSpell == null)
if (affectSpell == null || affectSpell.SpellFamilyName != SpellFamilyName)
return false; return false;
// true return IsAffected(affectSpell.SpellFamilyName, mod.mask);
if (mod.mask & SpellFamilyFlags)
return true;
return false;
} }
public bool CanPierceImmuneAura(SpellInfo aura) public bool CanPierceImmuneAura(SpellInfo aura)
+3 -6
View File
@@ -505,12 +505,9 @@ namespace Game.Entities
if (eventInfo.GetTypeMask().HasAnyFlag(ProcFlags.PeriodicMask | ProcFlags.SpellMask)) if (eventInfo.GetTypeMask().HasAnyFlag(ProcFlags.PeriodicMask | ProcFlags.SpellMask))
{ {
SpellInfo eventSpellInfo = eventInfo.GetSpellInfo(); SpellInfo eventSpellInfo = eventInfo.GetSpellInfo();
if (eventSpellInfo != null)
if (procEntry.SpellFamilyName != 0 && eventSpellInfo != null && (procEntry.SpellFamilyName != eventSpellInfo.SpellFamilyName)) if (!eventSpellInfo.IsAffected(procEntry.SpellFamilyName, procEntry.SpellFamilyMask))
return false; return false;
if (eventSpellInfo != null && !(procEntry.SpellFamilyMask & eventSpellInfo.SpellFamilyFlags))
return false;
} }
// check spell type mask (if set) // check spell type mask (if set)