Core/Spells: Named and implemented most of SpellAttr8

Port From (https://github.com/TrinityCore/TrinityCore/commit/dc9361fcc2eb16a59b52dfd8b0d47dfc1bf639be)
This commit is contained in:
hondacrx
2024-02-01 18:59:34 -05:00
parent e37c9558ad
commit 5869fbaee0
10 changed files with 232 additions and 87 deletions
+7 -6
View File
@@ -2004,7 +2004,7 @@ namespace Game.Entities
if (spellInfo == null || duration < 0)
return;
if (spellInfo.IsChanneled() && !spellInfo.HasAttribute(SpellAttr5.SpellHasteAffectsPeriodic))
if (spellInfo.IsChanneled() && !spellInfo.HasAttribute(SpellAttr5.SpellHasteAffectsPeriodic) && !spellInfo.HasAttribute(SpellAttr8.MeleeHasteAffectsPeriodic))
return;
// called from caster
@@ -2594,7 +2594,7 @@ namespace Game.Entities
if (!unitTarget.HasUnitFlag(UnitFlags.PlayerControlled) && unitOrOwner.IsImmuneToNPC())
return false;
if (bySpell == null || !bySpell.HasAttribute(SpellAttr8.AttackIgnoreImmuneToPCFlag))
if (bySpell == null || !bySpell.HasAttribute(SpellAttr8.AttackIgnoreImmuneToPcFlag))
{
if (unitOrOwner.HasUnitFlag(UnitFlags.PlayerControlled) && unitTarget.IsImmuneToPC())
return false;
@@ -2664,7 +2664,8 @@ namespace Game.Entities
// PvP case - can't attack when attacker or target are in sanctuary
// however, 13850 client doesn't allow to attack when one of the unit's has sanctuary flag and is pvp
if (unitTarget != null && unitTarget.HasUnitFlag(UnitFlags.PlayerControlled) && unitOrOwner != null && unitOrOwner.HasUnitFlag(UnitFlags.PlayerControlled) && (unitTarget.IsInSanctuary() || unitOrOwner.IsInSanctuary()))
if (unitTarget != null && unitTarget.HasUnitFlag(UnitFlags.PlayerControlled) && unitOrOwner != null && unitOrOwner.HasUnitFlag(UnitFlags.PlayerControlled)
&& (unitTarget.IsInSanctuary() || unitOrOwner.IsInSanctuary()) && (bySpell == null || bySpell.HasAttribute(SpellAttr8.IgnoreSanctuary)))
return false;
// additional checks - only PvP case
@@ -2738,7 +2739,7 @@ namespace Game.Entities
{
if (unit != null && unit.HasUnitFlag(UnitFlags.PlayerControlled))
{
if (bySpell == null || !bySpell.HasAttribute(SpellAttr8.AttackIgnoreImmuneToPCFlag))
if (bySpell == null || !bySpell.HasAttribute(SpellAttr8.AttackIgnoreImmuneToPcFlag))
if (unitTarget != null && unitTarget.IsImmuneToPC())
return false;
}
@@ -2771,7 +2772,7 @@ namespace Game.Entities
return false;
// can't assist player out of sanctuary from sanctuary if has pvp enabled
if (unitTarget.IsPvP())
if (unitTarget.IsPvP() && (bySpell == null || bySpell.HasAttribute(SpellAttr8.IgnoreSanctuary)))
if (unit.IsInSanctuary() && !unitTarget.IsInSanctuary())
return false;
}
@@ -2836,7 +2837,7 @@ namespace Game.Entities
{
return spellInfo.GetSpellXSpellVisualId(this);
}
public List<GameObject> GetGameObjectListWithEntryInGrid(uint entry = 0, float maxSearchRange = 250.0f)
{
List<GameObject> gameobjectList = new();
+4 -4
View File
@@ -274,7 +274,7 @@ namespace Game.Entities
return false;
}
public override SpellInfo GetCastSpellInfo(SpellInfo spellInfo)
public override SpellInfo GetCastSpellInfo(SpellInfo spellInfo, TriggerCastFlags triggerFlag)
{
var overrides = m_overrideSpells.LookupByKey(spellInfo.Id);
if (!overrides.Empty())
@@ -283,11 +283,11 @@ namespace Game.Entities
{
SpellInfo newInfo = Global.SpellMgr.GetSpellInfo(spellId, GetMap().GetDifficultyID());
if (newInfo != null)
return GetCastSpellInfo(newInfo);
return GetCastSpellInfo(newInfo, triggerFlag);
}
}
return base.GetCastSpellInfo(spellInfo);
return base.GetCastSpellInfo(spellInfo, triggerFlag);
}
public void SetOverrideSpellsId(uint overrideSpellsId) { SetUpdateFieldValue(m_values.ModifyValue(m_activePlayerData).ModifyValue(m_activePlayerData.OverrideSpellsID), overrideSpellsId); }
@@ -1778,7 +1778,7 @@ namespace Game.Entities
}
case ItemClass.Armor:
{
if (!spellInfo.HasAttribute(SpellAttr8.ArmorSpecialization))
if (!spellInfo.HasAttribute(SpellAttr8.RequiresEquippedInvTypes))
{
// most used check: shield only
if ((spellInfo.EquippedItemSubClassMask & (1 << (int)ItemSubClassArmor.Shield)) != 0)
+8 -2
View File
@@ -774,7 +774,7 @@ namespace Game.Entities
bool canDodge = !spellInfo.HasAttribute(SpellAttr7.NoAttackDodge);
bool canParry = !spellInfo.HasAttribute(SpellAttr7.NoAttackParry);
bool canBlock = true;
bool canBlock = !spellInfo.HasAttribute(SpellAttr8.NoAttackBlock);
// if victim is casting or cc'd it can't avoid attacks
if (victim.IsNonMeleeSpellCast(false, false, true) || victim.HasUnitState(UnitState.Controlled))
@@ -892,7 +892,7 @@ namespace Game.Entities
spell.Finish(result);
}
public virtual SpellInfo GetCastSpellInfo(SpellInfo spellInfo)
public virtual SpellInfo GetCastSpellInfo(SpellInfo spellInfo, TriggerCastFlags triggerFlag)
{
SpellInfo findMatchingAuraEffectIn(AuraType type)
{
@@ -903,7 +903,13 @@ namespace Game.Entities
{
SpellInfo info = Global.SpellMgr.GetSpellInfo((uint)auraEffect.GetAmount(), GetMap().GetDifficultyID());
if (info != null)
{
if (auraEffect.GetSpellInfo().HasAttribute(SpellAttr8.IgnoreSpellcastOverrideCost))
triggerFlag |= TriggerCastFlags.IgnorePowerAndReagentCost;
return info;
}
}
}