Core/Spells: require phasemask set for periodic damage procflag
Port From (https://github.com/TrinityCore/TrinityCore/commit/91fa279bdf67646ab15601ec18096c0a45133ebf)
This commit is contained in:
@@ -2436,9 +2436,7 @@ namespace Framework.Constants
|
|||||||
SpellMask = DoneSpellMeleeDmgClass | TakenSpellMeleeDmgClass | DoneRangedAutoAttack | TakenRangedAutoAttack
|
SpellMask = DoneSpellMeleeDmgClass | TakenSpellMeleeDmgClass | DoneRangedAutoAttack | TakenRangedAutoAttack
|
||||||
| DoneSpellRangedDmgClass | TakenSpellRangedDmgClass | DoneSpellNoneDmgClassPos | TakenSpellNoneDmgClassPos
|
| DoneSpellRangedDmgClass | TakenSpellRangedDmgClass | DoneSpellNoneDmgClassPos | TakenSpellNoneDmgClassPos
|
||||||
| DoneSpellNoneDmgClassNeg | TakenSpellNoneDmgClassNeg | DoneSpellMagicDmgClassPos | TakenSpellMagicDmgClassPos
|
| DoneSpellNoneDmgClassNeg | TakenSpellNoneDmgClassNeg | DoneSpellMagicDmgClassPos | TakenSpellMagicDmgClassPos
|
||||||
| DoneSpellMagicDmgClassNeg | TakenSpellMagicDmgClassNeg | DoneTrapActivation,
|
| DoneSpellMagicDmgClassNeg | TakenSpellMagicDmgClassNeg | DonePeriodic | TakenPeriodic | DoneTrapActivation,
|
||||||
|
|
||||||
PeriodicMask = DonePeriodic | TakenPeriodic,
|
|
||||||
|
|
||||||
DoneHitMask = DoneMeleeAutoAttack | DoneRangedAutoAttack | DoneSpellMeleeDmgClass | DoneSpellRangedDmgClass
|
DoneHitMask = DoneMeleeAutoAttack | DoneRangedAutoAttack | DoneSpellMeleeDmgClass | DoneSpellRangedDmgClass
|
||||||
| DoneSpellNoneDmgClassPos | DoneSpellNoneDmgClassNeg | DoneSpellMagicDmgClassPos | DoneSpellMagicDmgClassNeg
|
| DoneSpellNoneDmgClassPos | DoneSpellNoneDmgClassNeg | DoneSpellMagicDmgClassPos | DoneSpellMagicDmgClassNeg
|
||||||
|
|||||||
@@ -1633,7 +1633,7 @@ namespace Game.Spells
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// check if aura can proc when spell is triggered (exception for hunter auto shot & wands)
|
// check if aura can proc when spell is triggered (exception for hunter auto shot & wands)
|
||||||
if (spell.IsTriggered() && !procEntry.AttributesMask.HasAnyFlag(ProcAttributes.TriggeredCanProc) && !eventInfo.GetTypeMask().HasAnyFlag(ProcFlags.AutoAttackMask))
|
if (spell.IsTriggered() && !procEntry.AttributesMask.HasAnyFlag(ProcAttributes.TriggeredCanProc) && !eventInfo.GetTypeMask().HasFlag(ProcFlags.AutoAttackMask))
|
||||||
if (!GetSpellInfo().HasAttribute(SpellAttr3.CanProcWithTriggered))
|
if (!GetSpellInfo().HasAttribute(SpellAttr3.CanProcWithTriggered))
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -1699,7 +1699,7 @@ namespace Game.Spells
|
|||||||
// But except periodic and kill triggers (can triggered from self)
|
// But except periodic and kill triggers (can triggered from self)
|
||||||
SpellInfo spellInfo = eventInfo.GetSpellInfo();
|
SpellInfo spellInfo = eventInfo.GetSpellInfo();
|
||||||
if (spellInfo != null)
|
if (spellInfo != null)
|
||||||
if (spellInfo.Id == GetId() && !eventInfo.GetTypeMask().HasAnyFlag(ProcFlags.TakenPeriodic | ProcFlags.Kill))
|
if (spellInfo.Id == GetId() && !eventInfo.GetTypeMask().HasFlag(ProcFlags.TakenPeriodic | ProcFlags.Kill))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// Check if current equipment meets aura requirements
|
// Check if current equipment meets aura requirements
|
||||||
|
|||||||
@@ -314,13 +314,6 @@ namespace Game.Spells
|
|||||||
// special cases
|
// special cases
|
||||||
switch (triggered_spell_id)
|
switch (triggered_spell_id)
|
||||||
{
|
{
|
||||||
// Vanish (not exist)
|
|
||||||
case 18461:
|
|
||||||
{
|
|
||||||
unitTarget.RemoveMovementImpairingAuras(true);
|
|
||||||
unitTarget.RemoveAurasByType(AuraType.ModStalked);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Demonic Empowerment -- succubus
|
// Demonic Empowerment -- succubus
|
||||||
case 54437:
|
case 54437:
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -469,7 +469,7 @@ namespace Game.Entities
|
|||||||
public static bool CanSpellTriggerProcOnEvent(SpellProcEntry procEntry, ProcEventInfo eventInfo)
|
public static bool CanSpellTriggerProcOnEvent(SpellProcEntry procEntry, ProcEventInfo eventInfo)
|
||||||
{
|
{
|
||||||
// proc type doesn't match
|
// proc type doesn't match
|
||||||
if (!Convert.ToBoolean(eventInfo.GetTypeMask() & procEntry.ProcFlags))
|
if (!eventInfo.GetTypeMask().HasFlag(procEntry.ProcFlags))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// check XP or honor target requirement
|
// check XP or honor target requirement
|
||||||
@@ -494,11 +494,11 @@ namespace Game.Entities
|
|||||||
}
|
}
|
||||||
|
|
||||||
// always trigger for these types
|
// always trigger for these types
|
||||||
if ((eventInfo.GetTypeMask() & (ProcFlags.Killed | ProcFlags.Kill | ProcFlags.Death)) != 0)
|
if (eventInfo.GetTypeMask().HasFlag(ProcFlags.Killed | ProcFlags.Kill | ProcFlags.Death))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// Do not consider autoattacks as triggered spells
|
// Do not consider autoattacks as triggered spells
|
||||||
if (!procEntry.AttributesMask.HasAnyFlag(ProcAttributes.TriggeredCanProc) && !eventInfo.GetTypeMask().HasAnyFlag(ProcFlags.AutoAttackMask))
|
if (!procEntry.AttributesMask.HasAnyFlag(ProcAttributes.TriggeredCanProc) && !eventInfo.GetTypeMask().HasFlag(ProcFlags.AutoAttackMask))
|
||||||
{
|
{
|
||||||
Spell spell = eventInfo.GetProcSpell();
|
Spell spell = eventInfo.GetProcSpell();
|
||||||
if (spell)
|
if (spell)
|
||||||
@@ -518,30 +518,27 @@ namespace Game.Entities
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
// check spell family name/flags (if set) for spells
|
// check spell family name/flags (if set) for spells
|
||||||
if (eventInfo.GetTypeMask().HasAnyFlag(ProcFlags.PeriodicMask | ProcFlags.SpellMask))
|
if (eventInfo.GetTypeMask().HasFlag(ProcFlags.SpellMask))
|
||||||
{
|
{
|
||||||
SpellInfo eventSpellInfo = eventInfo.GetSpellInfo();
|
SpellInfo eventSpellInfo = eventInfo.GetSpellInfo();
|
||||||
if (eventSpellInfo != null)
|
if (eventSpellInfo != null)
|
||||||
if (!eventSpellInfo.IsAffected(procEntry.SpellFamilyName, procEntry.SpellFamilyMask))
|
if (!eventSpellInfo.IsAffected(procEntry.SpellFamilyName, procEntry.SpellFamilyMask))
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
// check spell type mask (if set)
|
// check spell type mask (if set)
|
||||||
if ((eventInfo.GetTypeMask() & (ProcFlags.SpellMask | ProcFlags.PeriodicMask)) != 0)
|
|
||||||
{
|
|
||||||
if (procEntry.SpellTypeMask != 0 && !Convert.ToBoolean(eventInfo.GetSpellTypeMask() & procEntry.SpellTypeMask))
|
if (procEntry.SpellTypeMask != 0 && !Convert.ToBoolean(eventInfo.GetSpellTypeMask() & procEntry.SpellTypeMask))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check spell phase mask
|
// check spell phase mask
|
||||||
if ((eventInfo.GetTypeMask() & ProcFlags.ReqSpellPhaseMask) != 0)
|
if (eventInfo.GetTypeMask().HasFlag(ProcFlags.ReqSpellPhaseMask))
|
||||||
{
|
{
|
||||||
if (!Convert.ToBoolean(eventInfo.GetSpellPhaseMask() & procEntry.SpellPhaseMask))
|
if (!Convert.ToBoolean(eventInfo.GetSpellPhaseMask() & procEntry.SpellPhaseMask))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check hit mask (on taken hit or on done hit, but not on spell cast phase)
|
// check hit mask (on taken hit or on done hit, but not on spell cast phase)
|
||||||
if ((eventInfo.GetTypeMask() & ProcFlags.TakenHitMask) != 0 || ((eventInfo.GetTypeMask() & ProcFlags.DoneHitMask) != 0
|
if (eventInfo.GetTypeMask().HasFlag(ProcFlags.TakenHitMask) || (eventInfo.GetTypeMask().HasFlag(ProcFlags.DoneHitMask)
|
||||||
&& !Convert.ToBoolean(eventInfo.GetSpellPhaseMask() & ProcFlagsSpellPhase.Cast)))
|
&& !Convert.ToBoolean(eventInfo.GetSpellPhaseMask() & ProcFlagsSpellPhase.Cast)))
|
||||||
{
|
{
|
||||||
ProcFlagsHit hitMask = procEntry.HitMask;
|
ProcFlagsHit hitMask = procEntry.HitMask;
|
||||||
@@ -549,7 +546,7 @@ namespace Game.Entities
|
|||||||
if (hitMask == 0)
|
if (hitMask == 0)
|
||||||
{
|
{
|
||||||
// for taken procs allow normal + critical hits by default
|
// for taken procs allow normal + critical hits by default
|
||||||
if ((eventInfo.GetTypeMask() & ProcFlags.TakenHitMask) != 0)
|
if (eventInfo.GetTypeMask().HasFlag(ProcFlags.TakenHitMask))
|
||||||
hitMask |= ProcFlagsHit.Normal | ProcFlagsHit.Critical;
|
hitMask |= ProcFlagsHit.Normal | ProcFlagsHit.Critical;
|
||||||
// for done procs allow normal + critical + absorbs by default
|
// for done procs allow normal + critical + absorbs by default
|
||||||
else
|
else
|
||||||
@@ -1416,7 +1413,7 @@ namespace Game.Entities
|
|||||||
Log.outError(LogFilter.Sql, "`spell_proc` table entry for spellId {0} doesn't have `ProcFlags` value defined, proc will not be triggered", spellInfo.Id);
|
Log.outError(LogFilter.Sql, "`spell_proc` table entry for spellId {0} doesn't have `ProcFlags` value defined, proc will not be triggered", spellInfo.Id);
|
||||||
if (Convert.ToBoolean(procEntry.SpellTypeMask & ~ProcFlagsSpellType.MaskAll))
|
if (Convert.ToBoolean(procEntry.SpellTypeMask & ~ProcFlagsSpellType.MaskAll))
|
||||||
Log.outError(LogFilter.Sql, "`spell_proc` table entry for spellId {0} has wrong `SpellTypeMask` set: {1}", spellInfo.Id, procEntry.SpellTypeMask);
|
Log.outError(LogFilter.Sql, "`spell_proc` table entry for spellId {0} has wrong `SpellTypeMask` set: {1}", spellInfo.Id, procEntry.SpellTypeMask);
|
||||||
if (procEntry.SpellTypeMask != 0 && !Convert.ToBoolean(procEntry.ProcFlags & (ProcFlags.SpellMask | ProcFlags.PeriodicMask)))
|
if (procEntry.SpellTypeMask != 0 && !Convert.ToBoolean(procEntry.ProcFlags & (ProcFlags.SpellMask)))
|
||||||
Log.outError(LogFilter.Sql, "`spell_proc` table entry for spellId {0} has `SpellTypeMask` value defined, but it won't be used for defined `ProcFlags` value", spellInfo.Id);
|
Log.outError(LogFilter.Sql, "`spell_proc` table entry for spellId {0} has `SpellTypeMask` value defined, but it won't be used for defined `ProcFlags` value", spellInfo.Id);
|
||||||
if (procEntry.SpellPhaseMask == 0 && Convert.ToBoolean(procEntry.ProcFlags & ProcFlags.ReqSpellPhaseMask))
|
if (procEntry.SpellPhaseMask == 0 && Convert.ToBoolean(procEntry.ProcFlags & ProcFlags.ReqSpellPhaseMask))
|
||||||
Log.outError(LogFilter.Sql, "`spell_proc` table entry for spellId {0} doesn't have `SpellPhaseMask` value defined, but it's required for defined `ProcFlags` value, proc will not be triggered", spellInfo.Id);
|
Log.outError(LogFilter.Sql, "`spell_proc` table entry for spellId {0} doesn't have `SpellPhaseMask` value defined, but it's required for defined `ProcFlags` value, proc will not be triggered", spellInfo.Id);
|
||||||
|
|||||||
@@ -1380,7 +1380,7 @@ namespace Scripts.Spells.Items
|
|||||||
|
|
||||||
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||||
{
|
{
|
||||||
if (eventInfo.GetTypeMask().HasAnyFlag(ProcFlags.DoneRangedAutoAttack | ProcFlags.DoneSpellRangedDmgClass))
|
if (eventInfo.GetTypeMask().HasFlag(ProcFlags.DoneRangedAutoAttack | ProcFlags.DoneSpellRangedDmgClass))
|
||||||
{
|
{
|
||||||
// in that case, do not cast heal spell
|
// in that case, do not cast heal spell
|
||||||
PreventDefaultAction();
|
PreventDefaultAction();
|
||||||
@@ -2886,10 +2886,10 @@ namespace Scripts.Spells.Items
|
|||||||
Unit caster = eventInfo.GetActor();
|
Unit caster = eventInfo.GetActor();
|
||||||
Unit target = eventInfo.GetProcTarget();
|
Unit target = eventInfo.GetProcTarget();
|
||||||
|
|
||||||
if (eventInfo.GetTypeMask().HasAnyFlag(ProcFlags.DoneSpellMagicDmgClassPos))
|
if (eventInfo.GetTypeMask().HasFlag(ProcFlags.DoneSpellMagicDmgClassPos))
|
||||||
caster.CastSpell(target, _healProcSpellId, new CastSpellExtraArgs(aurEff));
|
caster.CastSpell(target, _healProcSpellId, new CastSpellExtraArgs(aurEff));
|
||||||
|
|
||||||
if (eventInfo.GetTypeMask().HasAnyFlag(ProcFlags.DoneSpellMagicDmgClassNeg))
|
if (eventInfo.GetTypeMask().HasFlag(ProcFlags.DoneSpellMagicDmgClassNeg))
|
||||||
caster.CastSpell(target, _damageProcSpellId, new CastSpellExtraArgs(aurEff));
|
caster.CastSpell(target, _damageProcSpellId, new CastSpellExtraArgs(aurEff));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
UPDATE `spell_proc` SET `SpellPhaseMask` = `SpellPhaseMask`|0x2 WHERE `SpellId` IN (28716,37603,38394,40438,40478,45054,57870,60170,60487,64752,64824,64914,70664,70730,70841,70854,71606,71637);
|
||||||
Reference in New Issue
Block a user