Core/Spells: Defined and implemented some new spell attributes

Port From (https://github.com/TrinityCore/TrinityCore/commit/1912999b9e4b1f1b7503e404d359dfeac38c3d29)
This commit is contained in:
hondacrx
2021-05-18 13:08:05 -04:00
parent 58bbbade44
commit 0f16ad75d0
9 changed files with 23 additions and 23 deletions
@@ -1667,7 +1667,7 @@ namespace Framework.Constants
{
IgnoreResistances = 0x01, // 0 Spells With This Attribute Will Completely Ignore The Target'S Resistance (These Spells Can'T Be Resisted)
ProcOnlyOnCaster = 0x02, // 1 Proc Only On Effects With TargetUnitCaster?
Unk2 = 0x04, // 2
AuraExpiresOffline = 0x04, // 2 duration is removed from aura while player is logged out
Unk3 = 0x08, // 3
Unk4 = 0x10, // 4 This Will No Longer Cause Guards To Attack On Use??
Unk5 = 0x20, // 5
@@ -1688,7 +1688,7 @@ namespace Framework.Constants
NotCheckSelfcastPower = 0x100000, // 20 Supersedes Message "More Powerful Spell Applied" For Self Casts.
DontRemoveInArena = 0x200000, // 21 Pally Aura, Dk Presence, Dudu Form, Warrior Stance, Shadowform, Hunter Track
Unk22 = 0x400000, // 22 Seal Of Command (42058,57770) And Gymer'S Smash 55426
Unk23 = 0x800000, // 23
SuppressWeaponProcs = 0x800000, // 23 spells with this flag should not trigger item spells / enchants (mostly in conjunction with SPELL_ATTR0_STOP_ATTACK_TARGET)
Unk24 = 0x1000000, // 24 Some Shoot Spell
IsPetScaling = 0x2000000, // 25 Pet Scaling Auras
CastOnlyInOutland = 0x4000000, // 26 Can Only Be Used In Outland.
@@ -1702,7 +1702,7 @@ namespace Framework.Constants
{
CanChannelWhenMoving = 0x01, // 0 available casting channel spell when moving
NoReagentWhilePrep = 0x02, // 1 Not Need Reagents If UnitFlagPreparation
Unk2 = 0x04, // 2
RemoveEnteringArena = 0x04, // 2 remove this aura on arena enter
UsableWhileStunned = 0x08, // 3 Usable While Stunned
Unk4 = 0x10, // 4
SingleTargetSpell = 0x20, // 5 Only One Target Can Be Apply At A Time
@@ -1726,7 +1726,7 @@ namespace Framework.Constants
Unk23 = 0x800000, // 23
Unk24 = 0x1000000, // 24
Unk25 = 0x2000000, // 25
Unk26 = 0x4000000, // 26 Aoe Related - Boulder, Cannon, Corpse Explosion, Fire Nova, Flames, Frost Bomb, Living Bomb, Seed Of Corruption, Starfall, Thunder Clap, Volley
AlwaysAoeLineOfSight = 0x4000000, // 26 Aoe Related - Boulder, Cannon, Corpse Explosion, Fire Nova, Flames, Frost Bomb, Living Bomb, Seed Of Corruption, Starfall, Thunder Clap, Volley
DontShowAuraIfSelfCast = 0x8000000, // 27
DontShowAuraIfNotSelfCast = 0x10000000, // 28
Unk29 = 0x20000000, // 29
@@ -1740,7 +1740,7 @@ namespace Framework.Constants
IgnoreCasterAuras = 0x04, // 2
AssistIgnoreImmuneFlag = 0x08, // 3
Unk4 = 0x10, // 4
Unk5 = 0x20, // 5
DoNotConsumeResources = 0x20, // 5 dont consume proc charges
UseSpellCastEvent = 0x40, // 6
Unk7 = 0x80, // 7
CantTargetCrowdControlled = 0x100, // 8
@@ -1762,9 +1762,9 @@ namespace Framework.Constants
CanTargetUntargetable = 0x1000000, // 24
NotResetSwingIfInstant = 0x2000000, // 25 Exorcism, Flash Of Light
Unk26 = 0x4000000, // 26 Related To Player Castable Positive Buff
Unk27 = 0x8000000, // 27
IgnoreHealingModifiers = 0x8000000, // 27 some custom rules - complicated
Unk28 = 0x10000000, // 28 Death Grip
NoDonePctDamageMods = 0x20000000, // 29 Ignores Done Percent Damage Mods?
IgnoreCasterDamageModifiers = 0x20000000, // 29 ignores done percent damage mods? some custom rules - complicated
Unk30 = 0x40000000, // 30
IgnoreCategoryCooldownMods = 0x80000000 // 31 Some Special Cooldown Calc? Only 2894
}
+1 -1
View File
@@ -891,7 +891,7 @@ namespace Game.Entities
}
// negative effects should continue counting down after logout
if (remainTime != -1 && !spellInfo.IsPositive())
if (remainTime != -1 && (!spellInfo.IsPositive() || spellInfo.HasAttribute(SpellAttr4.AuraExpiresOffline)))
{
if (remainTime / Time.InMilliseconds <= timediff)
continue;
+1 -1
View File
@@ -521,7 +521,7 @@ namespace Game.Entities
}
// negative effects should continue counting down after logout
if (remainTime != -1 && !spellInfo.IsPositive())
if (remainTime != -1 && (!spellInfo.IsPositive() || spellInfo.HasAttribute(SpellAttr4.AuraExpiresOffline)))
{
if (remainTime / Time.InMilliseconds <= timediff)
continue;
+5 -4
View File
@@ -172,7 +172,7 @@ namespace Game.Entities
return 1.0f;
// Some spells don't benefit from pct done mods
if (spellProto.HasAttribute(SpellAttr6.NoDonePctDamageMods))
if (spellProto.HasAttribute(SpellAttr6.IgnoreCasterDamageModifiers))
return 1.0f;
// For totems pct done mods are calculated when its calculation is run on the player in SpellDamageBonusDone.
@@ -3761,9 +3761,10 @@ namespace Game.Entities
RemoveAppliedAuras(aurApp =>
{
Aura aura = aurApp.GetBase();
return !aura.GetSpellInfo().HasAttribute(SpellAttr4.DontRemoveInArena) // don't remove stances, shadowform, pally/hunter auras
&& !aura.IsPassive() // don't remove passive auras
&& (aurApp.IsPositive() || !aura.GetSpellInfo().HasAttribute(SpellAttr3.DeathPersistent)); // not negative death persistent auras
return (!aura.GetSpellInfo().HasAttribute(SpellAttr4.DontRemoveInArena) // don't remove stances, shadowform, pally/hunter auras
&& !aura.IsPassive() // don't remove passive auras
&& (aurApp.IsPositive() || !aura.GetSpellInfo().HasAttribute(SpellAttr3.DeathPersistent))) || // not negative death persistent auras
aura.GetSpellInfo().HasAttribute(SpellAttr5.RemoveEnteringArena); // special marker, always remove
});
}
public void RemoveAllAurasExceptType(AuraType type)
+2 -3
View File
@@ -490,7 +490,6 @@ namespace Game.Entities
m_Events.KillAllEvents(false); // non-delatable (currently casted spells) will not deleted now but it will deleted at call in Map.RemoveAllObjectsInRemoveList
CombatStop();
GetThreatManager().ClearAllThreat();
}
public override void CleanupsBeforeDelete(bool finalCleanup = true)
{
@@ -2970,7 +2969,7 @@ namespace Game.Entities
if (damagetype != DamageEffectType.NoDamage)
{
if (victim != this && (spellProto == null || !spellProto.HasAttribute(SpellAttr7.NoPushbackOnDamage)))
if (victim != this && (spellProto == null || !(spellProto.HasAttribute(SpellAttr7.NoPushbackOnDamage) || spellProto.HasAttribute(SpellAttr3.TreatAsPeriodic))))
{
if (damagetype != DamageEffectType.DOT)
{
@@ -3829,7 +3828,7 @@ namespace Game.Entities
{
// Some spells don't benefit from pct done mods
// mods for SPELL_SCHOOL_MASK_NORMAL are already factored in base melee damage calculation
if (!spellProto.HasAttribute(SpellAttr6.NoDonePctDamageMods) && !spellProto.GetSchoolMask().HasAnyFlag(SpellSchoolMask.Normal))
if (!spellProto.HasAttribute(SpellAttr6.IgnoreCasterDamageModifiers) && !spellProto.GetSchoolMask().HasAnyFlag(SpellSchoolMask.Normal))
{
float maxModDamagePercentSchool = 0.0f;
Player thisPlayer = ToPlayer();
+1 -1
View File
@@ -1628,7 +1628,7 @@ namespace Game.Spells
Cypher.Assert(procEntry != null);
// take one charge, aura expiration will be handled in Aura.TriggerProcOnEvent (if needed)
if (!procEntry.AttributesMask.HasAnyFlag(ProcAttributes.UseStacksForCharges) && IsUsingCharges())
if (!procEntry.AttributesMask.HasAnyFlag(ProcAttributes.UseStacksForCharges) && IsUsingCharges() && (eventInfo.GetSpellInfo() == null || !eventInfo.GetSpellInfo().HasAttribute(SpellAttr6.DoNotConsumeResources)))
{
--m_procCharges;
SetNeedClientUpdateForTargets();
+4 -4
View File
@@ -1997,7 +1997,7 @@ namespace Game.Spells
DamageInfo spellDamageInfo = new(damageInfo, DamageEffectType.SpellDirect, m_attackType, hitMask);
caster.ProcSkillsAndAuras(unitTarget, procAttacker, procVictim, ProcFlagsSpellType.Damage, ProcFlagsSpellPhase.Hit, hitMask, this, spellDamageInfo, null);
if (caster.IsPlayer() && !m_spellInfo.HasAttribute(SpellAttr0.StopAttackTarget) &&
if (caster.IsPlayer() && !m_spellInfo.HasAttribute(SpellAttr0.StopAttackTarget) && !m_spellInfo.HasAttribute(SpellAttr4.SuppressWeaponProcs) &&
(m_spellInfo.DmgClass == SpellDmgClass.Melee || m_spellInfo.DmgClass == SpellDmgClass.Ranged))
caster.ToPlayer().CastItemCombatSpell(spellDamageInfo);
}
@@ -2014,7 +2014,7 @@ namespace Game.Spells
DamageInfo spellNoDamageInfo = new(damageInfo, DamageEffectType.NoDamage, m_attackType, hitMask);
caster.ProcSkillsAndAuras(unitTarget, procAttacker, procVictim, ProcFlagsSpellType.NoDmgHeal, ProcFlagsSpellPhase.Hit, hitMask, this, spellNoDamageInfo, null);
if (caster.IsPlayer() && !m_spellInfo.HasAttribute(SpellAttr0.StopAttackTarget) &&
if (caster.IsPlayer() && !m_spellInfo.HasAttribute(SpellAttr0.StopAttackTarget) && !m_spellInfo.HasAttribute(SpellAttr4.SuppressWeaponProcs) &&
(m_spellInfo.DmgClass == SpellDmgClass.Melee || m_spellInfo.DmgClass == SpellDmgClass.Ranged))
caster.ToPlayer().CastItemCombatSpell(spellNoDamageInfo);
}
@@ -4741,7 +4741,7 @@ namespace Game.Spells
losTarget = dynObj;
}
if (!m_spellInfo.HasAttribute(SpellAttr2.CanTargetNotInLos) && !Global.DisableMgr.IsDisabledFor(DisableType.Spell, m_spellInfo.Id, null, DisableFlags.SpellLOS)
if (!m_spellInfo.HasAttribute(SpellAttr2.CanTargetNotInLos) && !m_spellInfo.HasAttribute(SpellAttr5.AlwaysAoeLineOfSight) && !Global.DisableMgr.IsDisabledFor(DisableType.Spell, m_spellInfo.Id, null, DisableFlags.SpellLOS)
&& !unitTarget.IsWithinLOSInMap(losTarget, LineOfSightChecks.All, ModelIgnoreFlags.M2))
return SpellCastResult.LineOfSight;
}
@@ -4754,7 +4754,7 @@ namespace Game.Spells
float x, y, z;
m_targets.GetDstPos().GetPosition(out x, out y, out z);
if (!m_spellInfo.HasAttribute(SpellAttr2.CanTargetNotInLos) && !Global.DisableMgr.IsDisabledFor(DisableType.Spell, m_spellInfo.Id, null, DisableFlags.SpellLOS)
if (!m_spellInfo.HasAttribute(SpellAttr2.CanTargetNotInLos) && !m_spellInfo.HasAttribute(SpellAttr5.AlwaysAoeLineOfSight) && !Global.DisableMgr.IsDisabledFor(DisableType.Spell, m_spellInfo.Id, null, DisableFlags.SpellLOS)
&& !m_caster.IsWithinLOS(x, y, z, LineOfSightChecks.All, ModelIgnoreFlags.M2))
return SpellCastResult.LineOfSight;
}
+1 -1
View File
@@ -2580,7 +2580,7 @@ namespace Game.Spells
// if (addPctMods) { percent mods are added in Unit::CalculateDamage } else { percent mods are added in Unit::MeleeDamageBonusDone }
// this distinction is neccessary to properly inform the client about his autoattack damage values from Script_UnitDamage
bool addPctMods = !m_spellInfo.HasAttribute(SpellAttr6.NoDonePctDamageMods) && m_spellSchoolMask.HasAnyFlag(SpellSchoolMask.Normal);
bool addPctMods = !m_spellInfo.HasAttribute(SpellAttr6.IgnoreCasterDamageModifiers) && m_spellSchoolMask.HasAnyFlag(SpellSchoolMask.Normal);
if (addPctMods)
{
UnitMods unitMod;
+1 -1
View File
@@ -3386,7 +3386,7 @@ namespace Game.Entities
break;
case 70106: // Chilled to the Bone
spellInfo.AttributesEx3 |= SpellAttr3.NoDoneBonus;
spellInfo.AttributesEx6 |= SpellAttr6.NoDonePctDamageMods;
spellInfo.AttributesEx6 |= SpellAttr6.IgnoreCasterDamageModifiers;
break;
case 71614: // Ice Lock
spellInfo.Mechanic = Mechanics.Stun;