From e458f581d478b2a413b68580333f36e7fcd41526 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Thu, 14 Oct 2021 19:49:54 -0400 Subject: [PATCH] Core/Spells: Fixed Righteous Defense crash caused by modifying target list inside effect handler Port From (https://github.com/TrinityCore/TrinityCore/commit/990e4d86576751c517549eecc0747b2a8b65129a) --- Source/Game/Spells/SpellEffects.cs | 36 ------------------------------ 1 file changed, 36 deletions(-) diff --git a/Source/Game/Spells/SpellEffects.cs b/Source/Game/Spells/SpellEffects.cs index dcd1aa4c1..576caf02d 100644 --- a/Source/Game/Spells/SpellEffects.cs +++ b/Source/Game/Spells/SpellEffects.cs @@ -214,42 +214,6 @@ namespace Game.Spells if (!unitTarget && !gameObjTarget && !itemTarget) return; - // selection by spell family - switch (m_spellInfo.SpellFamilyName) - { - case SpellFamilyNames.Paladin: - switch (m_spellInfo.Id) - { - case 31789: // Righteous Defense (step 1) - { - // Clear targets for eff 1 - foreach (var hit in m_UniqueTargetInfo) - hit.EffectMask &= ~Convert.ToUInt32(1 << 1); - - // not empty (checked), copy - var attackers = unitTarget.GetAttackers(); - - // remove invalid attackers - foreach (var att in attackers) - if (!att.IsValidAttackTarget(m_caster)) - attackers.Remove(att); - - // selected from list 3 - int maxTargets = Math.Min(3, attackers.Count); - for (uint i = 0; i < maxTargets; ++i) - { - Unit attacker = attackers.SelectRandom(); - AddUnitTarget(attacker, 1 << 1); - attackers.Remove(attacker); - } - - // now let next effect cast spell at each target. - return; - } - } - break; - } - // pet auras if (m_caster.GetTypeId() == TypeId.Player) {