Core/Spells: Cleanup spell effects
Port From (https://github.com/TrinityCore/TrinityCore/commit/8a4e1119ac21e2d1112d1717337597fe073e495f)
This commit is contained in:
@@ -5136,9 +5136,10 @@ namespace Game.Entities
|
||||
CastSpellExtraArgs args = new(TriggerCastFlags.FullMask);
|
||||
args.CastItem = artifact;
|
||||
if (artifactPowerRank.AuraPointsOverride != 0)
|
||||
for (int i = 0; i < SpellConst.MaxEffects; ++i)
|
||||
if (spellInfo.GetEffect((uint)i) != null)
|
||||
args.AddSpellMod(SpellValueMod.BasePoint0 + i, (int)artifactPowerRank.AuraPointsOverride);
|
||||
{
|
||||
foreach (var spellEffectInfo in spellInfo.GetEffects())
|
||||
args.AddSpellMod(SpellValueMod.BasePoint0 + (int)spellEffectInfo.EffectIndex, (int)artifactPowerRank.AuraPointsOverride);
|
||||
}
|
||||
|
||||
CastSpell(this, artifactPowerRank.SpellID, args);
|
||||
}
|
||||
|
||||
@@ -107,9 +107,9 @@ namespace Game.Entities
|
||||
|
||||
// check learned spells state
|
||||
bool found = false;
|
||||
foreach (SpellEffectInfo eff in spellInfo.GetEffects())
|
||||
foreach (var spellEffectInfo in spellInfo.GetEffects())
|
||||
{
|
||||
if (eff != null && eff.Effect == SpellEffectName.LearnSpell && !HasSpell(eff.TriggerSpell))
|
||||
if (spellEffectInfo.IsEffect(SpellEffectName.LearnSpell) && !HasSpell(spellEffectInfo.TriggerSpell))
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
@@ -121,9 +121,6 @@ namespace Game.Entities
|
||||
return;
|
||||
|
||||
SpellEffectInfo effect = spellInfo.GetEffect(0);
|
||||
if (effect == null)
|
||||
return;
|
||||
|
||||
uint learned_0 = effect.TriggerSpell;
|
||||
if (!HasSpell(learned_0))
|
||||
{
|
||||
|
||||
@@ -1711,8 +1711,8 @@ namespace Game.Entities
|
||||
// special check to filter things like Shield Wall, the aura is not permanent and must stay even without required item
|
||||
if (!spellInfo.IsPassive())
|
||||
{
|
||||
foreach (SpellEffectInfo effect in spellInfo.GetEffects())
|
||||
if (effect != null && effect.IsAura())
|
||||
foreach (var spellEffectInfo in spellInfo.GetEffects())
|
||||
if (spellEffectInfo.IsAura())
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -2284,9 +2284,9 @@ namespace Game.Entities
|
||||
// passive spells which apply aura and have an item requirement are to be added manually, instead of casted
|
||||
if (spellInfo.EquippedItemClass >= 0)
|
||||
{
|
||||
foreach (SpellEffectInfo effectInfo in spellInfo.GetEffects())
|
||||
foreach (var spellEffectInfo in spellInfo.GetEffects())
|
||||
{
|
||||
if (effectInfo != null && effectInfo.IsAura())
|
||||
if (spellEffectInfo.IsAura())
|
||||
{
|
||||
if (!HasAura(spellInfo.Id) && HasItemFitToSpellRequirements(spellInfo))
|
||||
AddAura(spellInfo.Id, this);
|
||||
@@ -3289,10 +3289,10 @@ namespace Game.Entities
|
||||
|
||||
int effectPct = Math.Max(0, 100 - (lvlDifference * lvlPenaltyFactor));
|
||||
|
||||
for (byte i = 0; i < SpellConst.MaxEffects; ++i)
|
||||
foreach (var spellEffectInfo in spellInfo.GetEffects())
|
||||
{
|
||||
if (spellInfo.GetEffect(i).IsEffect())
|
||||
args.AddSpellMod(SpellValueMod.BasePoint0 + i, MathFunctions.CalculatePct(spellInfo.GetEffect(i).CalcValue(this), effectPct));
|
||||
if (spellEffectInfo.IsEffect())
|
||||
args.AddSpellMod(SpellValueMod.BasePoint0 + (int)spellEffectInfo.EffectIndex, MathFunctions.CalculatePct(spellEffectInfo.CalcValue(this), effectPct));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -91,9 +91,9 @@ namespace Game.Entities
|
||||
RemoveSpell(talent.SpellID, true);
|
||||
|
||||
// search for spells that the talent teaches and unlearn them
|
||||
foreach (SpellEffectInfo effect in spellInfo.GetEffects())
|
||||
if (effect != null && effect.TriggerSpell > 0 && effect.Effect == SpellEffectName.LearnSpell)
|
||||
RemoveSpell(effect.TriggerSpell, true);
|
||||
foreach (var spellEffectInfo in spellInfo.GetEffects())
|
||||
if (spellEffectInfo.IsEffect(SpellEffectName.LearnSpell) && spellEffectInfo.TriggerSpell > 0)
|
||||
RemoveSpell(spellEffectInfo.TriggerSpell, true);
|
||||
|
||||
if (talent.OverridesSpellID != 0)
|
||||
RemoveOverrideSpell(talent.OverridesSpellID, talent.SpellID);
|
||||
@@ -301,9 +301,9 @@ namespace Game.Entities
|
||||
RemoveSpell(talentInfo.SpellID, true);
|
||||
|
||||
// search for spells that the talent teaches and unlearn them
|
||||
foreach (SpellEffectInfo effect in spellInfo.GetEffects())
|
||||
if (effect != null && effect.TriggerSpell > 0 && effect.Effect == SpellEffectName.LearnSpell)
|
||||
RemoveSpell(effect.TriggerSpell, true);
|
||||
foreach (var spellEffectInfo in spellInfo.GetEffects())
|
||||
if (spellEffectInfo.IsEffect(SpellEffectName.LearnSpell) && spellEffectInfo.TriggerSpell > 0)
|
||||
RemoveSpell(spellEffectInfo.TriggerSpell, true);
|
||||
|
||||
if (talentInfo.OverridesSpellID != 0)
|
||||
RemoveOverrideSpell(talentInfo.OverridesSpellID, talentInfo.SpellID);
|
||||
@@ -318,9 +318,9 @@ namespace Game.Entities
|
||||
RemoveSpell(talentInfo.SpellID, true);
|
||||
|
||||
// search for spells that the talent teaches and unlearn them
|
||||
foreach (SpellEffectInfo effect in spellInfo.GetEffects())
|
||||
if (effect != null && effect.TriggerSpell > 0 && effect.Effect == SpellEffectName.LearnSpell)
|
||||
RemoveSpell(effect.TriggerSpell, true);
|
||||
foreach (var spellEffectInfo in spellInfo.GetEffects())
|
||||
if (spellEffectInfo.IsEffect(SpellEffectName.LearnSpell) && spellEffectInfo.TriggerSpell > 0)
|
||||
RemoveSpell(spellEffectInfo.TriggerSpell, true);
|
||||
|
||||
if (talentInfo.OverridesSpellID != 0)
|
||||
RemoveOverrideSpell(talentInfo.OverridesSpellID, talentInfo.SpellID);
|
||||
|
||||
@@ -3636,19 +3636,16 @@ namespace Game.Entities
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool IsImmunedToSpellEffect(SpellInfo spellInfo, uint index, WorldObject caster)
|
||||
public override bool IsImmunedToSpellEffect(SpellInfo spellInfo, SpellEffectInfo spellEffectInfo, WorldObject caster)
|
||||
{
|
||||
SpellEffectInfo effect = spellInfo.GetEffect(index);
|
||||
if (effect == null || !effect.IsEffect())
|
||||
return false;
|
||||
|
||||
// players are immune to taunt (the aura and the spell effect).
|
||||
if (effect.IsAura(AuraType.ModTaunt))
|
||||
return true;
|
||||
if (effect.IsEffect(SpellEffectName.AttackMe))
|
||||
if (spellEffectInfo.IsAura(AuraType.ModTaunt))
|
||||
return true;
|
||||
|
||||
return base.IsImmunedToSpellEffect(spellInfo, index, caster);
|
||||
if (spellEffectInfo.IsEffect(SpellEffectName.AttackMe))
|
||||
return true;
|
||||
|
||||
return base.IsImmunedToSpellEffect(spellInfo, spellEffectInfo, caster);
|
||||
}
|
||||
|
||||
void RegenerateAll()
|
||||
|
||||
Reference in New Issue
Block a user