Core/Spells: Rename SpellAttr6 to use official attribute names

Port From (https://github.com/TrinityCore/TrinityCore/commit/94aac14b4da2d6d2b7565dfdb91313f09a87f168)
This commit is contained in:
hondacrx
2022-06-01 15:55:27 -04:00
parent 399d39a4b9
commit 7bc70c02ad
7 changed files with 50 additions and 54 deletions
+5 -5
View File
@@ -2525,7 +2525,7 @@ namespace Game.Entities
if (unit != null)
{
// can't attack invisible
if (bySpell == null || !bySpell.HasAttribute(SpellAttr6.CanTargetInvisible))
if (bySpell == null || !bySpell.HasAttribute(SpellAttr6.IgnorePhaseShift))
{
if (!unit.CanSeeOrDetect(target, bySpell != null && bySpell.IsAffectingArea()))
return false;
@@ -2557,7 +2557,7 @@ namespace Game.Entities
unitOrOwner = go.GetOwner();
// ignore immunity flags when assisting
if (unitOrOwner != null && unitTarget != null && !(isPositiveSpell && bySpell.HasAttribute(SpellAttr6.AssistIgnoreImmuneFlag)))
if (unitOrOwner != null && unitTarget != null && !(isPositiveSpell && bySpell.HasAttribute(SpellAttr6.CanAssistImmunePc)))
{
if (!unitOrOwner.HasUnitFlag(UnitFlags.PlayerControlled) && unitTarget.IsImmuneToNPC())
return false;
@@ -2687,7 +2687,7 @@ namespace Game.Entities
}
// can't assist invisible
if ((bySpell == null || !bySpell.HasAttribute(SpellAttr6.CanTargetInvisible)) && !CanSeeOrDetect(target, bySpell != null && bySpell.IsAffectingArea()))
if ((bySpell == null || !bySpell.HasAttribute(SpellAttr6.IgnorePhaseShift)) && !CanSeeOrDetect(target, bySpell != null && bySpell.IsAffectingArea()))
return false;
// can't assist dead
@@ -2702,7 +2702,7 @@ namespace Game.Entities
if (isNegativeSpell && unitTarget != null && unitTarget.HasUnitFlag(UnitFlags.NonAttackable | UnitFlags.OnTaxi | UnitFlags.NotAttackable1 | UnitFlags.NonAttackable2))
return false;
if (isNegativeSpell || bySpell == null || !bySpell.HasAttribute(SpellAttr6.AssistIgnoreImmuneFlag))
if (isNegativeSpell || bySpell == null || !bySpell.HasAttribute(SpellAttr6.CanAssistImmunePc))
{
if (unit != null && unit.HasUnitFlag(UnitFlags.PlayerControlled))
{
@@ -2748,7 +2748,7 @@ namespace Game.Entities
// !target.HasFlag(UNIT_FIELD_FLAGS, UnitFlags.PvpAttackable) &&
else if (unit != null && unit.HasUnitFlag(UnitFlags.PlayerControlled))
{
if (bySpell == null || !bySpell.HasAttribute(SpellAttr6.AssistIgnoreImmuneFlag))
if (bySpell == null || !bySpell.HasAttribute(SpellAttr6.CanAssistImmunePc))
{
if (unitTarget != null && !unitTarget.IsPvP())
{
+2 -6
View File
@@ -40,7 +40,7 @@ namespace Game.Spells
public Spell(WorldObject caster, SpellInfo info, TriggerCastFlags triggerFlags, ObjectGuid originalCasterGUID = default, ObjectGuid originalCastId = default)
{
m_spellInfo = info;
m_caster = (info.HasAttribute(SpellAttr6.CastByCharmer) && caster.GetCharmerOrOwner() != null ? caster.GetCharmerOrOwner() : caster);
m_caster = (info.HasAttribute(SpellAttr6.OriginateFromController) && caster.GetCharmerOrOwner() != null ? caster.GetCharmerOrOwner() : caster);
m_spellValue = new SpellValue(m_spellInfo, caster);
m_castItemLevel = -1;
@@ -5861,10 +5861,6 @@ namespace Game.Spells
if (unitCaster == null)
return SpellCastResult.SpellCastOk;
// spells totally immuned to caster auras (wsg flag drop, give marks etc)
if (m_spellInfo.HasAttribute(SpellAttr6.IgnoreCasterAuras))
return SpellCastResult.SpellCastOk;
// these attributes only show the spell as usable on the client when it has related aura applied
// still they need to be checked against certain mechanics
@@ -7156,7 +7152,7 @@ namespace Game.Spells
if (IsTriggered())
return false;
if (m_casttime == 0 && m_spellInfo.HasAttribute(SpellAttr6.NotResetSwingIfInstant))
if (m_casttime == 0 && m_spellInfo.HasAttribute(SpellAttr6.DoesntResetSwingTimerIfInstant))
return false;
return true;
+1 -1
View File
@@ -384,7 +384,7 @@ namespace Game.Spells
if (cooldown >= TimeSpan.Zero)
applySpellMod(ref cooldown);
if (categoryCooldown >= TimeSpan.Zero && !spellInfo.HasAttribute(SpellAttr6.IgnoreCategoryCooldownMods))
if (categoryCooldown >= TimeSpan.Zero && !spellInfo.HasAttribute(SpellAttr6.NoCategoryCooldownMods))
applySpellMod(ref categoryCooldown);
}
+4 -4
View File
@@ -884,7 +884,7 @@ namespace Game.Spells
var mapEntry = CliDB.MapStorage.LookupByKey(map_id);
// raid instance limitation
if (HasAttribute(SpellAttr6.NotInRaidInstance))
if (HasAttribute(SpellAttr6.NotInRaidInstances))
{
if (mapEntry == null || mapEntry.IsRaid())
return SpellCastResult.NotInRaidInstance;
@@ -1003,7 +1003,7 @@ namespace Game.Spells
return SpellCastResult.BadTargets;
// check visibility - ignore stealth for implicit (area) targets
if (!HasAttribute(SpellAttr6.CanTargetInvisible) && !caster.CanSeeOrDetect(target, Implicit))
if (!HasAttribute(SpellAttr6.IgnorePhaseShift) && !caster.CanSeeOrDetect(target, Implicit))
return SpellCastResult.BadTargets;
Unit unitTarget = target.ToUnit();
@@ -1095,7 +1095,7 @@ namespace Game.Spells
return SpellCastResult.TargetsDead;
// check this flag only for implicit targets (chain and area), allow to explicitly target units for spells like Shield of Righteousness
if (Implicit && HasAttribute(SpellAttr6.CantTargetCrowdControlled) && !unitTarget.CanFreeMove())
if (Implicit && HasAttribute(SpellAttr6.DoNotChainToCrowdControlledTargets) && !unitTarget.CanFreeMove())
return SpellCastResult.BadTargets;
if (!CheckTargetCreatureType(unitTarget))
@@ -1237,7 +1237,7 @@ namespace Game.Spells
checkMask = VehicleSeatFlags.CanAttack;
var vehicleSeat = vehicle.GetSeatForPassenger(caster);
if (!HasAttribute(SpellAttr6.CastableWhileOnVehicle) && !HasAttribute(SpellAttr0.AllowWhileMounted)
if (!HasAttribute(SpellAttr6.AllowWhileRidingVehicle) && !HasAttribute(SpellAttr0.AllowWhileMounted)
&& (vehicleSeat.Flags & (int)checkMask) != (int)checkMask)
return SpellCastResult.CantDoThatRightNow;
+2 -2
View File
@@ -3328,7 +3328,7 @@ namespace Game.Entities
41487 // Envenom - Black Temple
}, spellInfo =>
{
spellInfo.AttributesEx6 |= SpellAttr6.CanTargetInvisible;
spellInfo.AttributesEx6 |= SpellAttr6.IgnorePhaseShift;
});
// Oscillation Field
@@ -4073,7 +4073,7 @@ namespace Game.Entities
// Twilight Mending
ApplySpellFix(new[] { 75509 }, spellInfo =>
{
spellInfo.AttributesEx6 |= SpellAttr6.CanTargetInvisible;
spellInfo.AttributesEx6 |= SpellAttr6.IgnorePhaseShift;
spellInfo.AttributesEx2 |= SpellAttr2.IgnoreLineOfSight;
});