Core/Spells: Named and implemented most of SpellAttr7

Port From (https://github.com/TrinityCore/TrinityCore/commit/4e87bd7942d932225436940f62e26d48719a42dd)
This commit is contained in:
hondacrx
2024-02-01 15:39:38 -05:00
parent abb4092cff
commit bb2df1c0f9
11 changed files with 151 additions and 136 deletions
+30 -19
View File
@@ -945,7 +945,7 @@ namespace Game.Entities
public void SetSilencedSchoolMask(SpellSchoolMask schoolMask) { SetUpdateFieldFlagValue(m_values.ModifyValue(m_unitData).ModifyValue(m_unitData.SilencedSchoolMask), (uint)schoolMask); }
public void ReplaceAllSilencedSchoolMask(SpellSchoolMask schoolMask) { SetUpdateFieldValue(m_values.ModifyValue(m_unitData).ModifyValue(m_unitData.SilencedSchoolMask), (uint)schoolMask); }
public SpellHistory GetSpellHistory() { return _spellHistory; }
public static ProcFlagsHit CreateProcHitMask(SpellNonMeleeDamage damageInfo, SpellMissInfo missCondition)
@@ -1511,10 +1511,18 @@ namespace Game.Entities
}
WeaponAttackType attType = damageInfo != null ? damageInfo.GetAttackType() : WeaponAttackType.BaseAttack;
if (typeMaskActor && actor != null)
SpellInfo spellInfo = null;
if (spell != null)
spellInfo = spell.GetSpellInfo();
else if (damageInfo != null)
spellInfo = damageInfo.GetSpellInfo();
else if (healInfo != null)
spellInfo = healInfo.GetSpellInfo();
if (typeMaskActor != null && actor != null && !(spellInfo != null && spellInfo.HasAttribute(SpellAttr3.SuppressCasterProcs)))
actor.ProcSkillsAndReactives(false, actionTarget, typeMaskActor, hitMask, attType);
if (typeMaskActionTarget && actionTarget != null)
if (typeMaskActionTarget && actionTarget != null && !(spellInfo != null && spellInfo.HasAttribute(SpellAttr3.SuppressTargetProcs)))
actionTarget.ProcSkillsAndReactives(true, actor, typeMaskActionTarget, hitMask, attType);
if (actor != null)
@@ -1903,9 +1911,12 @@ namespace Game.Entities
Player bgPlayer = unit.ToPlayer();
if (bgPlayer != null)
{
Battleground bg = bgPlayer.GetBattleground();
if (bg != null)
bg.UpdatePlayerScore(bgPlayer, ScoreType.HealingDone, (uint)gain);
if (healInfo.GetSpellInfo() == null || !healInfo.GetSpellInfo().HasAttribute(SpellAttr7.DoNotCountForPvpScoreboard))
{
Battleground bg = bgPlayer.GetBattleground();
if (bg != null)
bg.UpdatePlayerScore(bgPlayer, ScoreType.HealingDone, (uint)gain);
}
// use the actual gain, as the overheal shall not be counted, skip gain 0 (it ignored anyway in to criteria)
if (gain != 0)
@@ -2758,7 +2769,7 @@ namespace Game.Entities
return false;
}
public bool HasNegativeAuraWithInterruptFlag(SpellAuraInterruptFlags flag, ObjectGuid guid = default)
{
if (!HasInterruptFlag(flag))
@@ -2806,7 +2817,7 @@ namespace Game.Entities
return false;
}
public uint GetAuraCount(uint spellId)
{
uint count = 0;
@@ -2873,7 +2884,7 @@ namespace Game.Entities
// The charges / stack amounts don't count towards the total number of auras that can be dispelled.
// Ie: A dispel on a target with 5 stacks of Winters Chill and a Polymorph has 1 / (1 + 1) . 50% chance to dispell
// Polymorph instead of 1 / (5 + 1) . 16%.
bool dispelCharges = aura.GetSpellInfo().HasAttribute(SpellAttr7.DispelCharges);
bool dispelCharges = aura.GetSpellInfo().HasAttribute(SpellAttr7.DispelRemovesCharges);
byte charges = dispelCharges ? aura.GetCharges() : aura.GetStackAmount();
if (charges > 0)
dispelList.Add(new DispelableAura(aura, chance, charges));
@@ -2911,7 +2922,7 @@ namespace Game.Entities
{
return false;
}
public void RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags flag, SpellInfo source = null)
{
if (!HasInterruptFlag(flag))
@@ -3038,7 +3049,7 @@ namespace Game.Entities
}
}
bool stealCharge = aura.GetSpellInfo().HasAttribute(SpellAttr7.DispelCharges);
bool stealCharge = aura.GetSpellInfo().HasAttribute(SpellAttr7.DispelRemovesCharges);
// Cast duration to unsigned to prevent permanent aura's such as Righteous Fury being permanently added to caster
uint dur = (uint)Math.Min(2u * Time.Minute * Time.InMilliseconds, aura.GetDuration());
@@ -3241,7 +3252,7 @@ namespace Game.Entities
// Call OnDispel hook on AuraScript
aura.CallScriptDispel(dispelInfo);
if (aura.GetSpellInfo().HasAttribute(SpellAttr7.DispelCharges))
if (aura.GetSpellInfo().HasAttribute(SpellAttr7.DispelRemovesCharges))
aura.ModCharges(-dispelInfo.GetRemovedCharges(), AuraRemoveMode.EnemySpell);
else
aura.ModStackAmount(-dispelInfo.GetRemovedCharges(), AuraRemoveMode.EnemySpell);
@@ -3455,7 +3466,7 @@ namespace Game.Entities
// this may be a dead loop if some events on aura remove will continiously apply aura on remove
// we want to have all auras removed, so use your brain when linking events
for (int counter = 0; !m_appliedAuras.Empty() || !m_ownedAuras.Empty(); counter++)
{
{
foreach (var aurAppIter in GetAppliedAuras())
_UnapplyAura(aurAppIter, AuraRemoveMode.Default);
@@ -3815,7 +3826,7 @@ namespace Game.Entities
}
return null;
}
// spell mustn't have familyflags
public AuraEffect GetAuraEffect(AuraType type, SpellFamilyNames family, FlagArray128 familyFlag, ObjectGuid casterGUID = default)
{
@@ -3903,7 +3914,7 @@ namespace Game.Entities
AuraApplication aurApp = GetAuraApplication(predicate);
return aurApp?.GetBase();
}
public uint BuildAuraStateUpdateForTarget(Unit target)
{
uint auraStates = m_unitData.AuraState & ~(uint)AuraStateType.PerCasterAuraStateMask;
@@ -3918,7 +3929,7 @@ namespace Game.Entities
public bool CanProc() { return m_procDeep == 0; }
public int GetProcChainLength() { return m_procChainLength; }
public void _ApplyAuraEffect(Aura aura, uint effIndex)
{
Cypher.Assert(aura != null);
@@ -3982,8 +3993,8 @@ namespace Game.Entities
if (player != null)
{
if (Global.ConditionMgr.IsSpellUsedInSpellClickConditions(aurApp.GetBase().GetId()))
player.UpdateVisibleGameobjectsOrSpellClicks();
player.UpdateVisibleGameobjectsOrSpellClicks();
player.FailCriteria(CriteriaFailEvent.GainAura, aurApp.GetBase().GetId());
player.StartCriteria(CriteriaStartEvent.GainAura, aurApp.GetBase().GetId());
player.UpdateCriteria(CriteriaType.GainAura, aurApp.GetBase().GetId());
@@ -4168,7 +4179,7 @@ namespace Game.Entities
//uint removedAuras = m_removedAurasCount;
RemoveAura(aurApp);
//if (hasMoreThanOneEffect || m_removedAurasCount > removedAuras + 1)
//continue;
//continue;
}
}
}
+2 -2
View File
@@ -2724,7 +2724,7 @@ namespace Game.Entities
if (killer != null)
{
// in bg, count dmg if victim is also a player
if (victim.IsPlayer())
if (victim.IsPlayer() && !(spellProto != null && spellProto.HasAttribute(SpellAttr7.DoNotCountForPvpScoreboard)))
{
Battleground bg = killer.GetBattleground();
if (bg != null)
@@ -2864,7 +2864,7 @@ namespace Game.Entities
if (damagetype != DamageEffectType.NoDamage && damagetype != DamageEffectType.DOT)
{
if (victim != attacker && (spellProto == null || !(spellProto.HasAttribute(SpellAttr6.NoPushback) || spellProto.HasAttribute(SpellAttr7.NoPushbackOnDamage) || spellProto.HasAttribute(SpellAttr3.TreatAsPeriodic))))
if (victim != attacker && (spellProto == null || !(spellProto.HasAttribute(SpellAttr6.NoPushback) || spellProto.HasAttribute(SpellAttr7.DontCauseSpellPushback) || spellProto.HasAttribute(SpellAttr3.TreatAsPeriodic))))
{
Spell spell = victim.GetCurrentSpell(CurrentSpellTypes.Generic);
if (spell != null)