Core/Spells: Rename SpellAttr3 to use official attribute names

Port From (https://github.com/TrinityCore/TrinityCore/commit/88d7b58a3dd8b0eb95c233a20c1608ddce73d9ea)
This commit is contained in:
hondacrx
2022-06-01 13:01:55 -04:00
parent 6d84850790
commit 8cddeb0fc5
10 changed files with 118 additions and 126 deletions
+9 -1
View File
@@ -1564,7 +1564,7 @@ namespace Game.Spells
if (existingAura.GetSpellInfo().IsChanneled())
return true;
if (m_spellInfo.HasAttribute(SpellAttr3.StackForDiffCasters))
if (m_spellInfo.HasAttribute(SpellAttr3.DotStackingRule))
return true;
// check same periodic auras
@@ -1820,6 +1820,14 @@ namespace Game.Spells
}
}
if (m_spellInfo.HasAttribute(SpellAttr3.OnlyProcOutdoors))
if (!target.IsOutdoors())
return 0;
if (m_spellInfo.HasAttribute(SpellAttr3.OnlyProcOnCaster))
if (target.GetGUID() != GetCasterGUID())
return 0;
bool success = RandomHelper.randChance(CalcProcChance(procEntry, eventInfo));
SetLastProcAttemptTime(now);
+31 -22
View File
@@ -289,7 +289,7 @@ namespace Game.Spells
if (noTargetFound)
{
SendCastResult(m_spellInfo.Id == 51690 ? SpellCastResult.OutOfRange : SpellCastResult.BadTargets);
SendCastResult(SpellCastResult.BadImplicitTargets);
Finish(false);
return;
}
@@ -1558,9 +1558,9 @@ namespace Game.Spells
break;
}
if (m_spellInfo.HasAttribute(SpellAttr3.OnlyTargetPlayers))
if (m_spellInfo.HasAttribute(SpellAttr3.OnlyOnPlayer))
retMask &= GridMapTypeMask.Corpse | GridMapTypeMask.Player;
if (m_spellInfo.HasAttribute(SpellAttr3.OnlyTargetGhosts))
if (m_spellInfo.HasAttribute(SpellAttr3.OnlyOnGhosts))
retMask &= GridMapTypeMask.Player;
if (condList != null)
@@ -2943,7 +2943,8 @@ namespace Game.Spells
if (!_triggeredCastFlags.HasAnyFlag(TriggerCastFlags.IgnoreAuraInterruptFlags) && !m_spellInfo.HasAttribute(SpellAttr2.NotAnAction))
m_originalCaster.RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags.ActionDelayed, m_spellInfo);
Unit.ProcSkillsAndAuras(m_originalCaster, null, procAttacker, new ProcFlagsInit(ProcFlags.None), ProcFlagsSpellType.MaskAll, ProcFlagsSpellPhase.Cast, hitMask, this, null, null);
if (!m_spellInfo.HasAttribute(SpellAttr3.SuppressCasterProcs))
Unit.ProcSkillsAndAuras(m_originalCaster, null, procAttacker, new ProcFlagsInit(ProcFlags.None), ProcFlagsSpellType.MaskAll, ProcFlagsSpellPhase.Cast, hitMask, this, null, null);
// Call CreatureAI hook OnSpellCast
Creature caster = m_originalCaster.ToCreature();
@@ -3209,7 +3210,8 @@ namespace Game.Spells
}
}
Unit.ProcSkillsAndAuras(m_originalCaster, null, procAttacker, new ProcFlagsInit(ProcFlags.None), ProcFlagsSpellType.MaskAll, ProcFlagsSpellPhase.Finish, m_hitMask, this, null, null);
if (!m_spellInfo.HasAttribute(SpellAttr3.SuppressCasterProcs))
Unit.ProcSkillsAndAuras(m_originalCaster, null, procAttacker, new ProcFlagsInit(ProcFlags.None), ProcFlagsSpellType.MaskAll, ProcFlagsSpellPhase.Finish, m_hitMask, this, null, null);
}
void SendSpellCooldown()
@@ -3354,7 +3356,8 @@ namespace Game.Spells
if (creatureCaster != null)
creatureCaster.ReleaseSpellFocus(this);
Unit.ProcSkillsAndAuras(unitCaster, null, new ProcFlagsInit(ProcFlags.CastEnded), new ProcFlagsInit(), ProcFlagsSpellType.MaskAll, ProcFlagsSpellPhase.None, ProcFlagsHit.None, this, null, null);
if (!m_spellInfo.HasAttribute(SpellAttr3.SuppressCasterProcs))
Unit.ProcSkillsAndAuras(unitCaster, null, new ProcFlagsInit(ProcFlags.CastEnded), new ProcFlagsInit(), ProcFlagsSpellType.MaskAll, ProcFlagsSpellPhase.None, ProcFlagsHit.None, this, null, null);
if (!ok)
return;
@@ -4229,7 +4232,7 @@ namespace Game.Spells
resurrectRequest.ResurrectOffererVirtualRealmAddress = Global.WorldMgr.GetVirtualRealmAddress();
resurrectRequest.Name = sentName;
resurrectRequest.Sickness = m_caster.IsUnit() && !m_caster.IsTypeId(TypeId.Player); // "you'll be afflicted with resurrection sickness"
resurrectRequest.UseTimer = !m_spellInfo.HasAttribute(SpellAttr3.IgnoreResurrectionTimer);
resurrectRequest.UseTimer = !m_spellInfo.HasAttribute(SpellAttr3.NoResTimer);
Pet pet = target.GetPet();
if (pet)
@@ -4866,8 +4869,8 @@ namespace Game.Spells
}
// Spell casted only on Battleground
if (m_spellInfo.HasAttribute(SpellAttr3.Battleground) && m_caster.IsTypeId(TypeId.Player))
if (!m_caster.ToPlayer().InBattleground())
if (m_spellInfo.HasAttribute(SpellAttr3.OnlyBattlegrounds))
if (!m_caster.GetMap().IsBattleground())
return SpellCastResult.OnlyBattlegrounds;
// do not allow spells to be cast in arenas or rated Battlegrounds
@@ -6783,7 +6786,7 @@ namespace Game.Spells
});
// main hand weapon required
if (m_spellInfo.HasAttribute(SpellAttr3.MainHand))
if (m_spellInfo.HasAttribute(SpellAttr3.RequiresMainHandWeapon))
{
SpellCastResult mainHandResult = weaponCheck(WeaponAttackType.BaseAttack);
if (mainHandResult != SpellCastResult.SpellCastOk)
@@ -6791,7 +6794,7 @@ namespace Game.Spells
}
// offhand hand weapon required
if (m_spellInfo.HasAttribute(SpellAttr3.ReqOffhand))
if (m_spellInfo.HasAttribute(SpellAttr3.RequiresOffHandWeapon))
{
SpellCastResult offHandResult = weaponCheck(WeaponAttackType.OffAttack);
if (offHandResult != SpellCastResult.SpellCastOk)
@@ -8195,13 +8198,12 @@ namespace Game.Spells
if ((MissCondition == SpellMissInfo.Immune || MissCondition == SpellMissInfo.Immune2) && spell.GetCaster().IsPlayer() && unit.IsPlayer() && spell.GetCaster().IsValidAttackTarget(unit, spell.GetSpellInfo()))
unit.SetInCombatWith(spell.GetCaster().ToPlayer());
_enablePVP = false; // need to check PvP state before spell effects, but act on it afterwards
// if target is flagged for pvp also flag caster if a player
_enablePVP = (MissCondition == SpellMissInfo.None || spell.m_spellInfo.HasAttribute(SpellAttr3.PvpEnabling))
&& unit.IsPvP() && spell.GetCaster().IsPlayer(); // need to check PvP state before spell effects, but act on it afterwards
if (_spellHitTarget)
{
// if target is flagged for pvp also flag caster if a player
if (unit.IsPvP() && spell.GetCaster().IsPlayer())
_enablePVP = true; // Decide on PvP flagging now, but act on it later.
SpellMissInfo missInfo = spell.PreprocessSpellHit(_spellHitTarget, this);
if (missInfo != SpellMissInfo.None)
{
@@ -8276,8 +8278,9 @@ namespace Game.Spells
ProcFlagsHit hitMask = ProcFlagsHit.None;
// Spells with this flag cannot trigger if effect is cast on self
bool canEffectTrigger = !spell.m_spellInfo.HasAttribute(SpellAttr3.CantTriggerProc) && spell.unitTarget.CanProc() &&
(spell.CanExecuteTriggersOnHit(EffectMask) || MissCondition == SpellMissInfo.Immune || MissCondition == SpellMissInfo.Immune2);
bool canEffectTrigger = (!spell.m_spellInfo.HasAttribute(SpellAttr3.SuppressCasterProcs) || !spell.m_spellInfo.HasAttribute(SpellAttr3.SuppressTargetProcs))
&& spell.unitTarget.CanProc()
&& (spell.CanExecuteTriggersOnHit(EffectMask) || MissCondition == SpellMissInfo.Immune || MissCondition == SpellMissInfo.Immune2);
// Trigger info was not filled in Spell::prepareDataForTriggerSystem - we do it now
if (canEffectTrigger && !procAttacker && !procVictim)
@@ -8440,6 +8443,12 @@ namespace Game.Spells
// Do triggers for unit
if (canEffectTrigger)
{
if (spell.m_spellInfo.HasAttribute(SpellAttr3.SuppressCasterProcs))
procAttacker = new ProcFlagsInit();
if (spell.m_spellInfo.HasAttribute(SpellAttr3.SuppressTargetProcs))
procVictim = new ProcFlagsInit();
Unit.ProcSkillsAndAuras(caster, spell.unitTarget, procAttacker, procVictim, procSpellType, ProcFlagsSpellPhase.Hit, hitMask, spell, spellDamageInfo, healInfo);
// item spells (spell hit of non-damage spell may also activate items, for example seal of corruption hidden hit)
@@ -8465,7 +8474,7 @@ namespace Game.Spells
if (unitCaster != null)
unitCaster.AtTargetAttacked(unit, spell.m_spellInfo.HasInitialAggro());
if (!unit.IsStandState())
if (!spell.m_spellInfo.HasAttribute(SpellAttr3.DoNotTriggerTargetStand) && !unit.IsStandState())
unit.SetStandState(UnitStandStateType.Stand);
}
@@ -8508,10 +8517,10 @@ namespace Game.Spells
// Needs to be called after dealing damage/healing to not remove breaking on damage auras
spell.DoTriggersOnSpellHit(_spellHitTarget, EffectMask);
if (_enablePVP)
spell.GetCaster().ToPlayer().UpdatePvP(true);
}
if (_enablePVP)
spell.GetCaster().ToPlayer().UpdatePvP(true);
spell.spellAura = HitAura;
spell.CallScriptAfterHitHandlers();
+11 -11
View File
@@ -475,7 +475,7 @@ namespace Game.Spells
public bool IsStackableOnOneSlotWithDifferentCasters()
{
// TODO: Re-verify meaning of SPELL_ATTR3_STACK_FOR_DIFF_CASTERS and update conditions here
return StackAmount > 1 && !IsChanneled() && !HasAttribute(SpellAttr3.StackForDiffCasters);
return StackAmount > 1 && !IsChanneled() && !HasAttribute(SpellAttr3.DotStackingRule);
}
public bool IsCooldownStartedOnEvent()
@@ -489,12 +489,12 @@ namespace Game.Spells
public bool IsDeathPersistent()
{
return HasAttribute(SpellAttr3.DeathPersistent);
return HasAttribute(SpellAttr3.AllowAuraWhileDead);
}
public bool IsRequiringDeadTarget()
{
return HasAttribute(SpellAttr3.OnlyTargetGhosts);
return HasAttribute(SpellAttr3.OnlyOnGhosts);
}
public bool IsAllowingDeadTarget()
@@ -594,7 +594,7 @@ namespace Game.Spells
switch (DmgClass)
{
case SpellDmgClass.Melee:
if (HasAttribute(SpellAttr3.ReqOffhand))
if (HasAttribute(SpellAttr3.RequiresOffHandWeapon))
result = WeaponAttackType.OffAttack;
else
result = WeaponAttackType.BaseAttack;
@@ -643,7 +643,7 @@ namespace Game.Spells
bool IsAffectedBySpellMods()
{
return !HasAttribute(SpellAttr3.NoDoneBonus);
return !HasAttribute(SpellAttr3.IgnoreCasterModifiers);
}
public bool IsAffectedBySpellMod(SpellModifier mod)
@@ -1025,9 +1025,9 @@ namespace Game.Spells
return SpellCastResult.TargetAffectingCombat;
// only spells with SPELL_ATTR3_ONLY_TARGET_GHOSTS can target ghosts
if (HasAttribute(SpellAttr3.OnlyTargetGhosts) != unitTarget.HasAuraType(AuraType.Ghost))
if (HasAttribute(SpellAttr3.OnlyOnGhosts) != unitTarget.HasAuraType(AuraType.Ghost))
{
if (HasAttribute(SpellAttr3.OnlyTargetGhosts))
if (HasAttribute(SpellAttr3.OnlyOnGhosts))
return SpellCastResult.TargetNotGhost;
else
return SpellCastResult.BadTargets;
@@ -1089,7 +1089,7 @@ namespace Game.Spells
return SpellCastResult.SpellCastOk;
// corpseOwner and unit specific target checks
if (HasAttribute(SpellAttr3.OnlyTargetPlayers) && !unitTarget.IsTypeId(TypeId.Player))
if (HasAttribute(SpellAttr3.OnlyOnPlayer) && !unitTarget.IsTypeId(TypeId.Player))
return SpellCastResult.TargetNotPlayer;
if (!IsAllowingDeadTarget() && !unitTarget.IsAlive())
@@ -2544,7 +2544,7 @@ namespace Game.Spells
}
}
if (!auraSpellInfo.HasAttribute(SpellAttr3.IgnoreHitResult))
if (!auraSpellInfo.HasAttribute(SpellAttr3.AlwaysHit))
{
AuraType auraName = auraSpellEffectInfo.ApplyAuraName;
if (auraName != 0)
@@ -2868,7 +2868,7 @@ namespace Game.Spells
else
{
WeaponAttackType slot = WeaponAttackType.BaseAttack;
if (!HasAttribute(SpellAttr3.MainHand) && HasAttribute(SpellAttr3.ReqOffhand))
if (!HasAttribute(SpellAttr3.RequiresMainHandWeapon) && HasAttribute(SpellAttr3.RequiresOffHandWeapon))
slot = WeaponAttackType.OffAttack;
speed = unitCaster.GetBaseAttackTime(slot);
@@ -3175,7 +3175,7 @@ namespace Game.Spells
return this;
// Client ignores spell with these attributes (sub_53D9D0)
if (HasAttribute(SpellAttr0.AuraIsDebuff) || HasAttribute(SpellAttr2.AllowLowLevelBuff) || HasAttribute(SpellAttr3.DrainSoul))
if (HasAttribute(SpellAttr0.AuraIsDebuff) || HasAttribute(SpellAttr2.AllowLowLevelBuff) || HasAttribute(SpellAttr3.OnlyProcOnCaster))
return this;
bool needRankSelection = false;
+11 -35
View File
@@ -2734,7 +2734,7 @@ namespace Game.Entities
}
// spells ignoring hit result should not be binary
if (!spellInfo.HasAttribute(SpellAttr3.IgnoreHitResult))
if (!spellInfo.HasAttribute(SpellAttr3.AlwaysHit))
{
bool setFlag = false;
foreach (var spellEffectInfo in spellInfo.GetEffects())
@@ -3185,12 +3185,6 @@ namespace Game.Entities
});
});
// Execute
ApplySpellFix(new[] { 5308 }, spellInfo =>
{
spellInfo.AttributesEx3 |= SpellAttr3.CantTriggerProc;
});
ApplySpellFix(new[] {
31347, // Doom
36327, // Shoot Arcane Explosion Arrow
@@ -3340,7 +3334,7 @@ namespace Game.Entities
// Oscillation Field
ApplySpellFix(new[] { 37408 }, spellInfo =>
{
spellInfo.AttributesEx3 |= SpellAttr3.StackForDiffCasters;
spellInfo.AttributesEx3 |= SpellAttr3.DotStackingRule;
});
// Crafty's Ultra-Advanced Proto-Typical Shortening Blaster
@@ -3397,12 +3391,6 @@ namespace Game.Entities
});
});
// Vampiric Embrace
ApplySpellFix(new[] { 15290 }, spellInfo =>
{
spellInfo.AttributesEx3 |= SpellAttr3.NoInitialAggro;
});
// Earthbind Totem (instant pulse)
ApplySpellFix(new[] { 6474 }, spellInfo =>
{
@@ -3475,7 +3463,7 @@ namespace Game.Entities
// Paralyze
ApplySpellFix(new[] { 48278 }, spellInfo =>
{
spellInfo.AttributesEx3 |= SpellAttr3.StackForDiffCasters;
spellInfo.AttributesEx3 |= SpellAttr3.DotStackingRule;
});
ApplySpellFix(new[] {
@@ -3685,7 +3673,7 @@ namespace Game.Entities
64381 // Strength of the Pack (Auriaya)
}, spellInfo =>
{
spellInfo.AttributesEx3 |= SpellAttr3.StackForDiffCasters;
spellInfo.AttributesEx3 |= SpellAttr3.DotStackingRule;
});
ApplySpellFix(new[] {
@@ -3845,13 +3833,7 @@ namespace Game.Entities
// Shadow's Fate
ApplySpellFix(new[] { 71169 }, spellInfo =>
{
spellInfo.AttributesEx3 |= SpellAttr3.StackForDiffCasters;
});
// Lock Players and Tap Chest
ApplySpellFix(new[] { 72347 }, spellInfo =>
{
spellInfo.AttributesEx3 &= ~SpellAttr3.NoInitialAggro;
spellInfo.AttributesEx3 |= SpellAttr3.DotStackingRule;
});
// Resistant Skin (Deathbringer Saurfang adds)
@@ -3918,7 +3900,7 @@ namespace Game.Entities
// Empowered Flare (Blood Prince Council)
ApplySpellFix(new[] { 71708 }, spellInfo =>
{
spellInfo.AttributesEx3 |= SpellAttr3.NoDoneBonus;
spellInfo.AttributesEx3 |= SpellAttr3.IgnoreCasterModifiers;
});
// Swarming Shadows
@@ -3930,7 +3912,7 @@ namespace Game.Entities
// Corruption
ApplySpellFix(new[] { 70602 }, spellInfo =>
{
spellInfo.AttributesEx3 |= SpellAttr3.StackForDiffCasters;
spellInfo.AttributesEx3 |= SpellAttr3.DotStackingRule;
});
// Column of Frost (visual marker)
@@ -3974,7 +3956,7 @@ namespace Game.Entities
// Chilled to the Bone
ApplySpellFix(new[] { 70106 }, spellInfo =>
{
spellInfo.AttributesEx3 |= SpellAttr3.NoDoneBonus;
spellInfo.AttributesEx3 |= SpellAttr3.IgnoreCasterModifiers;
spellInfo.AttributesEx6 |= SpellAttr6.IgnoreCasterDamageModifiers;
});
@@ -4024,7 +4006,7 @@ namespace Game.Entities
// Harvest Soul
ApplySpellFix(new[] { 73655 }, spellInfo =>
{
spellInfo.AttributesEx3 |= SpellAttr3.NoDoneBonus;
spellInfo.AttributesEx3 |= SpellAttr3.IgnoreCasterModifiers;
});
// Summon Shadow Trap
@@ -4194,12 +4176,6 @@ namespace Game.Entities
spellInfo.Stances = 1ul << ((int)ShapeShiftForm.TreeOfLife - 1);
});
// Feral Charge (Cat Form)
ApplySpellFix(new[] { 49376 }, spellInfo =>
{
spellInfo.AttributesEx3 &= ~SpellAttr3.CantTriggerProc;
});
// Gaze of Occu'thar
ApplySpellFix(new[] { 96942 }, spellInfo =>
{
@@ -4254,13 +4230,13 @@ namespace Game.Entities
// Baron Rivendare (Stratholme) - Unholy Aura
ApplySpellFix(new [] { 17466, 17467 }, spellInfo =>
{
spellInfo.AttributesEx3 |= SpellAttr3.NoInitialAggro;
spellInfo.AttributesEx2 |= SpellAttr2.NoInitialThreat;
});
// Spore - Spore Visual
ApplySpellFix(new[] { 42525 }, spellInfo =>
{
spellInfo.AttributesEx3 |= SpellAttr3.DeathPersistent;
spellInfo.AttributesEx3 |= SpellAttr3.AllowAuraWhileDead;
spellInfo.AttributesEx2 |= SpellAttr2.AllowDeadTarget;
});