Core/Spells: require phasemask set for periodic damage procflag

Port From (https://github.com/TrinityCore/TrinityCore/commit/91fa279bdf67646ab15601ec18096c0a45133ebf)
This commit is contained in:
hondacrx
2021-06-23 17:40:28 -04:00
parent f959a0fd91
commit 0daea24b3f
6 changed files with 16 additions and 27 deletions
@@ -2436,9 +2436,7 @@ namespace Framework.Constants
SpellMask = DoneSpellMeleeDmgClass | TakenSpellMeleeDmgClass | DoneRangedAutoAttack | TakenRangedAutoAttack
| DoneSpellRangedDmgClass | TakenSpellRangedDmgClass | DoneSpellNoneDmgClassPos | TakenSpellNoneDmgClassPos
| DoneSpellNoneDmgClassNeg | TakenSpellNoneDmgClassNeg | DoneSpellMagicDmgClassPos | TakenSpellMagicDmgClassPos
| DoneSpellMagicDmgClassNeg | TakenSpellMagicDmgClassNeg | DoneTrapActivation,
PeriodicMask = DonePeriodic | TakenPeriodic,
| DoneSpellMagicDmgClassNeg | TakenSpellMagicDmgClassNeg | DonePeriodic | TakenPeriodic | DoneTrapActivation,
DoneHitMask = DoneMeleeAutoAttack | DoneRangedAutoAttack | DoneSpellMeleeDmgClass | DoneSpellRangedDmgClass
| DoneSpellNoneDmgClassPos | DoneSpellNoneDmgClassNeg | DoneSpellMagicDmgClassPos | DoneSpellMagicDmgClassNeg
+2 -2
View File
@@ -1633,7 +1633,7 @@ namespace Game.Spells
return 0;
// 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))
return 0;
}
@@ -1699,7 +1699,7 @@ namespace Game.Spells
// But except periodic and kill triggers (can triggered from self)
SpellInfo spellInfo = eventInfo.GetSpellInfo();
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;
// Check if current equipment meets aura requirements
-7
View File
@@ -314,13 +314,6 @@ namespace Game.Spells
// special cases
switch (triggered_spell_id)
{
// Vanish (not exist)
case 18461:
{
unitTarget.RemoveMovementImpairingAuras(true);
unitTarget.RemoveAurasByType(AuraType.ModStalked);
return;
}
// Demonic Empowerment -- succubus
case 54437:
{
+9 -12
View File
@@ -469,7 +469,7 @@ namespace Game.Entities
public static bool CanSpellTriggerProcOnEvent(SpellProcEntry procEntry, ProcEventInfo eventInfo)
{
// proc type doesn't match
if (!Convert.ToBoolean(eventInfo.GetTypeMask() & procEntry.ProcFlags))
if (!eventInfo.GetTypeMask().HasFlag(procEntry.ProcFlags))
return false;
// check XP or honor target requirement
@@ -494,11 +494,11 @@ namespace Game.Entities
}
// 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;
// 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();
if (spell)
@@ -518,30 +518,27 @@ namespace Game.Entities
return false;
// 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();
if (eventSpellInfo != null)
if (!eventSpellInfo.IsAffected(procEntry.SpellFamilyName, procEntry.SpellFamilyMask))
return false;
}
// check spell type mask (if set)
if ((eventInfo.GetTypeMask() & (ProcFlags.SpellMask | ProcFlags.PeriodicMask)) != 0)
{
// check spell type mask (if set)
if (procEntry.SpellTypeMask != 0 && !Convert.ToBoolean(eventInfo.GetSpellTypeMask() & procEntry.SpellTypeMask))
return false;
}
// check spell phase mask
if ((eventInfo.GetTypeMask() & ProcFlags.ReqSpellPhaseMask) != 0)
if (eventInfo.GetTypeMask().HasFlag(ProcFlags.ReqSpellPhaseMask))
{
if (!Convert.ToBoolean(eventInfo.GetSpellPhaseMask() & procEntry.SpellPhaseMask))
return false;
}
// 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)))
{
ProcFlagsHit hitMask = procEntry.HitMask;
@@ -549,7 +546,7 @@ namespace Game.Entities
if (hitMask == 0)
{
// 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;
// for done procs allow normal + critical + absorbs by default
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);
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);
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);
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);
+3 -3
View File
@@ -1380,7 +1380,7 @@ namespace Scripts.Spells.Items
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
PreventDefaultAction();
@@ -2886,10 +2886,10 @@ namespace Scripts.Spells.Items
Unit caster = eventInfo.GetActor();
Unit target = eventInfo.GetProcTarget();
if (eventInfo.GetTypeMask().HasAnyFlag(ProcFlags.DoneSpellMagicDmgClassPos))
if (eventInfo.GetTypeMask().HasFlag(ProcFlags.DoneSpellMagicDmgClassPos))
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));
}
@@ -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);