Core/Spells: Cleanup spell effects
Port From (https://github.com/TrinityCore/TrinityCore/commit/8a4e1119ac21e2d1112d1717337597fe073e495f)
This commit is contained in:
@@ -2045,12 +2045,12 @@ namespace Game.Entities
|
||||
return false;
|
||||
|
||||
bool immunedToAllEffects = true;
|
||||
foreach (SpellEffectInfo effect in spellInfo.GetEffects())
|
||||
foreach (var spellEffectInfo in spellInfo.GetEffects())
|
||||
{
|
||||
if (effect == null || !effect.IsEffect())
|
||||
if (!spellEffectInfo.IsEffect())
|
||||
continue;
|
||||
|
||||
if (!IsImmunedToSpellEffect(spellInfo, effect.EffectIndex, caster))
|
||||
if (!IsImmunedToSpellEffect(spellInfo, spellEffectInfo, caster))
|
||||
{
|
||||
immunedToAllEffects = false;
|
||||
break;
|
||||
@@ -2063,16 +2063,12 @@ namespace Game.Entities
|
||||
return base.IsImmunedToSpell(spellInfo, caster);
|
||||
}
|
||||
|
||||
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)
|
||||
if (GetCreatureTemplate().CreatureType == CreatureType.Mechanical && spellEffectInfo.IsEffect(SpellEffectName.Heal))
|
||||
return true;
|
||||
|
||||
if (GetCreatureTemplate().CreatureType == CreatureType.Mechanical && effect.Effect == SpellEffectName.Heal)
|
||||
return true;
|
||||
|
||||
return base.IsImmunedToSpellEffect(spellInfo, index, caster);
|
||||
return base.IsImmunedToSpellEffect(spellInfo, spellEffectInfo, caster);
|
||||
}
|
||||
|
||||
public bool IsElite()
|
||||
|
||||
@@ -444,9 +444,9 @@ namespace Game.Misc
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(quest.RewardSpell, Difficulty.None);
|
||||
if (spellInfo != null)
|
||||
{
|
||||
foreach (SpellEffectInfo effect in spellInfo.GetEffects())
|
||||
if (effect != null && effect.IsEffect(SpellEffectName.LearnSpell))
|
||||
packet.LearnSpells.Add(effect.TriggerSpell);
|
||||
foreach (var spellEffectInfo in spellInfo.GetEffects())
|
||||
if (spellEffectInfo.IsEffect(SpellEffectName.LearnSpell))
|
||||
packet.LearnSpells.Add(spellEffectInfo.TriggerSpell);
|
||||
}
|
||||
|
||||
quest.BuildQuestRewards(packet.Rewards, _session.GetPlayer());
|
||||
|
||||
@@ -129,13 +129,13 @@ namespace Game.Entities
|
||||
// check ranks
|
||||
bool hasLearnSpellEffect = false;
|
||||
bool knowsAllLearnedSpells = true;
|
||||
foreach (SpellEffectInfo spellEffect in Global.SpellMgr.GetSpellInfo(trainerSpell.SpellId, Difficulty.None).GetEffects())
|
||||
foreach (var spellEffectInfo in Global.SpellMgr.GetSpellInfo(trainerSpell.SpellId, Difficulty.None).GetEffects())
|
||||
{
|
||||
if (spellEffect == null || !spellEffect.IsEffect(SpellEffectName.LearnSpell))
|
||||
if (!spellEffectInfo.IsEffect(SpellEffectName.LearnSpell))
|
||||
continue;
|
||||
|
||||
hasLearnSpellEffect = true;
|
||||
if (!player.HasSpell(spellEffect.TriggerSpell))
|
||||
if (!player.HasSpell(spellEffectInfo.TriggerSpell))
|
||||
knowsAllLearnedSpells = false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user