Core/Spells: Rename SpellAttr1 to use official attribute names

Port From (https://github.com/TrinityCore/TrinityCore/commit/c88b602a2c7eda598a4205dd0ec9f562c31f21b0)
This commit is contained in:
hondacrx
2022-05-31 22:13:24 -04:00
parent dc6eb46302
commit a2d9499152
10 changed files with 158 additions and 119 deletions
+1 -1
View File
@@ -2750,7 +2750,7 @@ namespace Game.Entities
public Unit GetMagicHitRedirectTarget(Unit victim, SpellInfo spellInfo)
{
// Patch 1.2 notes: Spell Reflection no longer reflects abilities
if (spellInfo.HasAttribute(SpellAttr0.IsAbility) || spellInfo.HasAttribute(SpellAttr1.CantBeRedirected) || spellInfo.HasAttribute(SpellAttr0.NoImmunities))
if (spellInfo.HasAttribute(SpellAttr0.IsAbility) || spellInfo.HasAttribute(SpellAttr1.NoRedirection) || spellInfo.HasAttribute(SpellAttr0.NoImmunities))
return victim;
var magnetAuras = victim.GetAuraEffectsByType(AuraType.SpellMagnet);
+8 -6
View File
@@ -1245,11 +1245,14 @@ namespace Game.Entities
}
}
public bool UpdateCraftSkill(uint spellid)
public bool UpdateCraftSkill(SpellInfo spellInfo)
{
Log.outDebug(LogFilter.Player, "UpdateCraftSkill spellid {0}", spellid);
if (spellInfo.HasAttribute(SpellAttr1.NoSkillIncrease))
return false;
var bounds = Global.SpellMgr.GetSkillLineAbilityMapBounds(spellid);
Log.outDebug(LogFilter.Player, "UpdateCraftSkill spellid {0}", spellInfo.Id);
var bounds = Global.SpellMgr.GetSkillLineAbilityMapBounds(spellInfo.Id);
foreach (var _spell_idx in bounds)
{
@@ -1258,10 +1261,9 @@ namespace Game.Entities
uint SkillValue = GetPureSkillValue((SkillType)_spell_idx.SkillupSkillLineID);
// Alchemy Discoveries here
SpellInfo spellEntry = Global.SpellMgr.GetSpellInfo(spellid, Difficulty.None);
if (spellEntry != null && spellEntry.Mechanic == Mechanics.Discovery)
if (spellInfo != null && spellInfo.Mechanic == Mechanics.Discovery)
{
uint discoveredSpell = SkillDiscovery.GetSkillDiscoverySpell(_spell_idx.SkillupSkillLineID, spellid, this);
uint discoveredSpell = SkillDiscovery.GetSkillDiscoverySpell(_spell_idx.SkillupSkillLineID, spellInfo.Id, this);
if (discoveredSpell != 0)
LearnSpell(discoveredSpell, false);
}
+28 -8
View File
@@ -1382,7 +1382,7 @@ namespace Game.Entities
if (spellInfo.HasAttribute(SpellAttr0.NoImmunities) && spellInfo.HasAttribute(SpellAttr3.IgnoreHitResult))
return false;
if (spellInfo.HasAttribute(SpellAttr1.UnaffectedBySchoolImmune) || spellInfo.HasAttribute(SpellAttr2.UnaffectedByAuraSchoolImmune))
if (spellInfo.HasAttribute(SpellAttr1.ImmunityToHostileAndFriendlyEffects) || spellInfo.HasAttribute(SpellAttr2.UnaffectedByAuraSchoolImmune))
return false;
uint schoolMask = (uint)spellInfo.GetSchoolMask();
@@ -2156,7 +2156,27 @@ namespace Game.Entities
// don't remove vehicle auras, passengers aren't supposed to drop off the vehicle
// don't remove clone caster on evade (to be verified)
RemoveAllAurasExceptType(AuraType.ControlVehicle, AuraType.CloneCaster);
bool evadeAuraCheck(Aura aura)
{
if (aura.HasEffectType(AuraType.ControlVehicle))
return false;
if (aura.HasEffectType(AuraType.CloneCaster))
return false;
if (aura.GetSpellInfo().HasAttribute(SpellAttr1.AuraStaysAfterCombat))
return false;
return true;
}
bool evadeAuraApplicationCheck(AuraApplication aurApp)
{
return evadeAuraCheck(aurApp.GetBase());
}
RemoveAppliedAuras(evadeAuraApplicationCheck);
RemoveOwnedAuras(evadeAuraCheck);
}
public void RemoveAllAurasOnDeath()
@@ -2895,7 +2915,7 @@ namespace Game.Entities
}
}
}
public void RemoveAurasDueToSpellBySteal(uint spellId, ObjectGuid casterGUID, WorldObject stealer)
public void RemoveAurasDueToSpellBySteal(uint spellId, ObjectGuid casterGUID, WorldObject stealer, int stolenCharges = 1)
{
var range = m_ownedAuras.LookupByKey(spellId);
foreach (var aura in range)
@@ -2935,9 +2955,9 @@ namespace Game.Entities
if (oldAura != null)
{
if (stealCharge)
oldAura.ModCharges(1);
oldAura.ModCharges(stolenCharges);
else
oldAura.ModStackAmount(1);
oldAura.ModStackAmount(stolenCharges);
oldAura.SetDuration((int)dur);
}
else
@@ -2962,16 +2982,16 @@ namespace Game.Entities
caster.GetSingleCastAuras().Add(aura);
}
// FIXME: using aura.GetMaxDuration() maybe not blizzlike but it fixes stealing of spells like Innervate
newAura.SetLoadedState(aura.GetMaxDuration(), (int)dur, stealCharge ? 1 : aura.GetCharges(), 1, recalculateMask, damage);
newAura.SetLoadedState(aura.GetMaxDuration(), (int)dur, stealCharge ? stolenCharges : aura.GetCharges(), (byte)stolenCharges, recalculateMask, damage);
newAura.ApplyForTargets();
}
}
}
if (stealCharge)
aura.ModCharges(-1, AuraRemoveMode.EnemySpell);
aura.ModCharges(-stolenCharges, AuraRemoveMode.EnemySpell);
else
aura.ModStackAmount(-1, AuraRemoveMode.EnemySpell);
aura.ModStackAmount(-stolenCharges, AuraRemoveMode.EnemySpell);
return;
}