Core/Spell: restore old proc system behaviour on auras self proc.

This commit is contained in:
hondacrx
2018-01-13 13:10:33 -05:00
parent b36ee2ef1c
commit 5587505199
11 changed files with 81 additions and 70 deletions
+4 -4
View File
@@ -1719,10 +1719,10 @@ namespace Game.Entities
public void ProcSkillsAndAuras(Unit actionTarget, ProcFlags typeMaskActor, ProcFlags typeMaskActionTarget, ProcFlagsSpellType spellTypeMask, ProcFlagsSpellPhase spellPhaseMask, ProcFlagsHit hitMask, Spell spell, DamageInfo damageInfo, HealInfo healInfo)
{
WeaponAttackType attType = damageInfo != null ? damageInfo.GetAttackType() : WeaponAttackType.BaseAttack;
if (typeMaskActor != 0 && CanProc())
if (typeMaskActor != 0)
ProcSkillsAndReactives(false, actionTarget, typeMaskActor, hitMask, attType);
if (typeMaskActionTarget != 0 && actionTarget && actionTarget.CanProc())
if (typeMaskActionTarget != 0 && actionTarget)
actionTarget.ProcSkillsAndReactives(true, this, typeMaskActionTarget, hitMask, attType);
TriggerAurasProcOnEvent(null, null, actionTarget, typeMaskActor, typeMaskActionTarget, spellTypeMask, spellPhaseMask, hitMask, spell, damageInfo, healInfo);
@@ -1832,7 +1832,7 @@ namespace Game.Entities
// prepare data for self trigger
ProcEventInfo myProcEventInfo = new ProcEventInfo(this, actionTarget, actionTarget, typeMaskActor, spellTypeMask, spellPhaseMask, hitMask, spell, damageInfo, healInfo);
List<Tuple<uint, AuraApplication>> myAurasTriggeringProc = new List<Tuple<uint, AuraApplication>>();
if (typeMaskActor != 0 && CanProc())
if (typeMaskActor != 0)
{
GetProcAurasTriggeredOnEvent(myAurasTriggeringProc, myProcAuras, myProcEventInfo);
@@ -1856,7 +1856,7 @@ namespace Game.Entities
// prepare data for target trigger
ProcEventInfo targetProcEventInfo = new ProcEventInfo(this, actionTarget, this, typeMaskActionTarget, spellTypeMask, spellPhaseMask, hitMask, spell, damageInfo, healInfo);
List<Tuple<uint, AuraApplication>> targetAurasTriggeringProc = new List<Tuple<uint, AuraApplication>>();
if (typeMaskActionTarget != 0 && actionTarget && actionTarget.CanProc())
if (typeMaskActionTarget != 0 && actionTarget)
actionTarget.GetProcAurasTriggeredOnEvent(targetAurasTriggeringProc, targetProcAuras, targetProcEventInfo);
TriggerAurasProcOnEvent(myProcEventInfo, myAurasTriggeringProc);
+27 -23
View File
@@ -1651,6 +1651,29 @@ namespace Game.Spells
if (procEntry == null)
return 0;
// check spell triggering us
Spell spell = eventInfo.GetProcSpell();
if (spell)
{
// Do not allow auras to proc from effect triggered from itself
if (spell.IsTriggeredByAura(m_spellInfo))
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 (!GetSpellInfo().HasAttribute(SpellAttr3.CanProcWithTriggered))
return 0;
}
// check don't break stealth attr present
if (m_spellInfo.HasAura(Difficulty.None, AuraType.ModStealth))
{
SpellInfo eventSpellInfo = eventInfo.GetSpellInfo();
if (eventSpellInfo != null)
if (eventSpellInfo.HasAttribute(SpellCustomAttributes.DontBreakStealth))
return 0;
}
// check if we have charges to proc with
if (IsUsingCharges())
{
@@ -1659,9 +1682,9 @@ namespace Game.Spells
if (procEntry.AttributesMask.HasAnyFlag(ProcAttributes.ReqSpellmod))
{
Spell spell = eventInfo.GetProcSpell();
if (spell != null)
if (!spell.m_appliedMods.Contains(this))
Spell eventSpell = eventInfo.GetProcSpell();
if (eventSpell != null)
if (!eventSpell.m_appliedMods.Contains(this))
return 0;
}
}
@@ -1671,28 +1694,9 @@ namespace Game.Spells
return 0;
// do checks against db data
if (!Global.SpellMgr.CanSpellTriggerProcOnEvent(procEntry, eventInfo))
if (!SpellManager.CanSpellTriggerProcOnEvent(procEntry, eventInfo))
return 0;
// check don't break stealth attr present
if (m_spellInfo.HasAura(Difficulty.None, AuraType.ModStealth))
{
SpellInfo spell = eventInfo.GetSpellInfo();
if (spell != null)
if (spell.HasAttribute(SpellCustomAttributes.DontBreakStealth))
return 0;
}
// check if aura can proc when spell is triggered (exception for hunter auto shot & wands)
if (!procEntry.AttributesMask.HasAnyFlag(ProcAttributes.TriggeredCanProc) && !eventInfo.GetTypeMask().HasAnyFlag(ProcFlags.AutoAttackMask))
{
Spell spell = eventInfo.GetProcSpell();
if (spell)
if (spell.IsTriggered())
if (!GetSpellInfo().HasAttribute(SpellAttr3.CanProcWithTriggered))
return 0;
}
// do checks using conditions table
if (!Global.ConditionMgr.IsObjectMeetingNotGroupedConditions(ConditionSourceType.SpellProc, GetId(), eventInfo.GetActor(), eventInfo.GetActionTarget()))
return 0;
+12 -6
View File
@@ -1881,7 +1881,7 @@ namespace Game.Spells
m_spellAura = null;
//Spells with this flag cannot trigger if effect is cast on self
bool canEffectTrigger = !m_spellInfo.HasAttribute(SpellAttr3.CantTriggerProc) && (CanExecuteTriggersOnHit(mask) || missInfo == SpellMissInfo.Immune || missInfo == SpellMissInfo.Immune2);
bool canEffectTrigger = !m_spellInfo.HasAttribute(SpellAttr3.CantTriggerProc) && unitTarget.CanProc() && (CanExecuteTriggersOnHit(mask) || missInfo == SpellMissInfo.Immune || missInfo == SpellMissInfo.Immune2);
Unit spellHitTarget = null;
@@ -7008,12 +7008,10 @@ namespace Game.Spells
int auraBaseAmount = aurEff.GetBaseAmount();
// proc chance is stored in effect amount
int chance = m_caster.CalculateSpellDamage(null, aurEff.GetSpellInfo(), aurEff.GetEffIndex(), auraBaseAmount);
chance *= aurEff.GetBase().GetStackAmount();
// build trigger and add to the list
HitTriggerSpell spellTriggerInfo;
spellTriggerInfo.triggeredSpell = spellInfo;
spellTriggerInfo.triggeredByAura = aurEff.GetSpellInfo();
spellTriggerInfo.chance = chance * aurEff.GetBase().GetStackAmount();
m_hitTriggerSpells.Add(spellTriggerInfo);
m_hitTriggerSpells.Add(new HitTriggerSpell(spellInfo, aurEff.GetSpellInfo(), chance));
}
}
}
@@ -7133,6 +7131,7 @@ namespace Game.Spells
}
public bool IsTriggered() { return _triggeredCastFlags.HasAnyFlag(TriggerCastFlags.FullMask); }
public bool IsTriggeredByAura(SpellInfo auraSpellInfo) { return (auraSpellInfo == m_triggeredByAuraSpell); }
public bool IsIgnoringCooldowns() { return _triggeredCastFlags.HasAnyFlag(TriggerCastFlags.IgnoreSpellAndCategoryCD); }
public bool IsProcDisabled() { return _triggeredCastFlags.HasAnyFlag(TriggerCastFlags.DisallowProcEvents); }
public bool IsChannelActive() { return m_caster.GetChannelSpellId() != 0; }
@@ -7382,6 +7381,13 @@ namespace Game.Spells
public struct HitTriggerSpell
{
public HitTriggerSpell(SpellInfo spellInfo, SpellInfo auraSpellInfo, int procChance)
{
triggeredSpell = spellInfo;
triggeredByAura = auraSpellInfo;
chance = procChance;
}
public SpellInfo triggeredSpell;
public SpellInfo triggeredByAura;
// ubyte triggeredByEffIdx This might be needed at a later stage - No need known for now
+1 -1
View File
@@ -450,7 +450,7 @@ namespace Game.Entities
return mSpellProcMap.LookupByKey(spellId);
}
public bool CanSpellTriggerProcOnEvent(SpellProcEntry procEntry, ProcEventInfo eventInfo)
public static bool CanSpellTriggerProcOnEvent(SpellProcEntry procEntry, ProcEventInfo eventInfo)
{
// proc type doesn't match
if (!Convert.ToBoolean(eventInfo.GetTypeMask() & procEntry.ProcFlags))