Core/Spells: Rename SpellAttr2 to use official attribute names

Port From (https://github.com/TrinityCore/TrinityCore/commit/dda375b9868d6dbe2a4d58b386bb90ae41d25e0d)
This commit is contained in:
hondacrx
2022-06-01 11:53:42 -04:00
parent a2d9499152
commit a198e03a1d
13 changed files with 256 additions and 157 deletions
+36 -25
View File
@@ -698,7 +698,7 @@ namespace Game.Spells
{
if (m_timeCla > diff)
m_timeCla -= (int)diff;
else if (caster != null)
else if (caster != null && (caster == GetOwner() || !GetSpellInfo().HasAttribute(SpellAttr2.NoTargetPerSecondCosts)))
{
if (!m_periodicCosts.Empty())
{
@@ -1008,7 +1008,7 @@ namespace Game.Spells
{
return GetCasterGUID() == target.GetGUID()
&& m_spellInfo.Stances != 0
&& !m_spellInfo.HasAttribute(SpellAttr2.NotNeedShapeshift)
&& !m_spellInfo.HasAttribute(SpellAttr2.AllowWhileNotShapeshiftedCasterForm)
&& !m_spellInfo.HasAttribute(SpellAttr0.NotShapeshifted);
}
@@ -1644,9 +1644,19 @@ namespace Game.Spells
return m_procCooldown > now;
}
public void AddProcCooldown(DateTime cooldownEnd)
public void AddProcCooldown(SpellProcEntry procEntry, DateTime now)
{
m_procCooldown = cooldownEnd;
// cooldowns should be added to the whole aura (see 51698 area aura)
int procCooldown = (int)procEntry.Cooldown;
Unit caster = GetCaster();
if (caster != null)
{
Player modOwner = caster.GetSpellModOwner();
if (modOwner != null)
modOwner.ApplySpellMod(GetSpellInfo(), SpellModOp.ProcCooldown, ref procCooldown);
}
m_procCooldown = now + TimeSpan.FromMilliseconds(procCooldown);
}
public void ResetProcCooldown()
@@ -1663,26 +1673,36 @@ namespace Game.Spells
SpellProcEntry procEntry = Global.SpellMgr.GetSpellProcEntry(GetSpellInfo());
Cypher.Assert(procEntry != null);
PrepareProcChargeDrop(procEntry, eventInfo);
// cooldowns should be added to the whole aura (see 51698 area aura)
AddProcCooldown(procEntry, now);
SetLastProcSuccessTime(now);
}
public void PrepareProcChargeDrop(SpellProcEntry procEntry, ProcEventInfo eventInfo)
{
// take one charge, aura expiration will be handled in Aura.TriggerProcOnEvent (if needed)
if (!procEntry.AttributesMask.HasAnyFlag(ProcAttributes.UseStacksForCharges) && IsUsingCharges() && (eventInfo.GetSpellInfo() == null || !eventInfo.GetSpellInfo().HasAttribute(SpellAttr6.DoNotConsumeResources)))
{
--m_procCharges;
SetNeedClientUpdateForTargets();
}
}
// cooldowns should be added to the whole aura (see 51698 area aura)
int procCooldown = (int)procEntry.Cooldown;
Unit caster = GetCaster();
if (caster != null)
public void ConsumeProcCharges(SpellProcEntry procEntry)
{
// Remove aura if we've used last charge to proc
if (procEntry.AttributesMask.HasFlag(ProcAttributes.UseStacksForCharges))
{
Player modOwner = caster.GetSpellModOwner();
if (modOwner != null)
modOwner.ApplySpellMod(GetSpellInfo(), SpellModOp.ProcCooldown, ref procCooldown);
ModStackAmount(-1);
}
else if (IsUsingCharges())
{
if (GetCharges() == 0)
Remove();
}
AddProcCooldown(now + TimeSpan.FromMilliseconds(procCooldown));
SetLastProcSuccessTime(now);
}
public uint GetProcEffectMask(AuraApplication aurApp, ProcEventInfo eventInfo, DateTime now)
@@ -1859,16 +1879,7 @@ namespace Game.Spells
CallScriptAfterProcHandlers(aurApp, eventInfo);
}
// Remove aura if we've used last charge to proc
if (Global.SpellMgr.GetSpellProcEntry(m_spellInfo).AttributesMask.HasAnyFlag(ProcAttributes.UseStacksForCharges))
{
ModStackAmount(-1);
}
else if (IsUsingCharges())
{
if (GetCharges() == 0)
Remove();
}
ConsumeProcCharges(Global.SpellMgr.GetSpellProcEntry(GetSpellInfo()));
}
public float CalcPPMProcChance(Unit actor)
+2 -6
View File
@@ -1308,7 +1308,7 @@ namespace Game.Spells
}
if (!shapeInfo.Flags.HasAnyFlag(SpellShapeshiftFormFlags.Stance))
target.RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags.Shapeshifting, GetId());
target.RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags.Shapeshifting, GetSpellInfo());
}
else
{
@@ -2837,7 +2837,7 @@ namespace Game.Spells
// remove all flag auras (they are positive, but they must be removed when you are immune)
if (GetSpellInfo().HasAttribute(SpellAttr1.ImmunityPurgesEffect)
&& GetSpellInfo().HasAttribute(SpellAttr2.DamageReducedShield))
&& GetSpellInfo().HasAttribute(SpellAttr2.FailOnAllTargetsImmune))
target.RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags.StealthOrInvis);
}
@@ -5206,10 +5206,6 @@ namespace Game.Spells
return;
}
// heal for caster damage (must be alive)
if (target != caster && GetSpellInfo().HasAttribute(SpellAttr2.HealthFunnel) && (caster == null || !caster.IsAlive()))
return;
// don't regen when permanent aura target has full power
if (GetBase().IsPermanent() && target.IsFullHealth())
return;