Core/Spells: Fixed Righteous Defense crash caused by modifying target list inside effect handler

* Already handled in a script
This commit is contained in:
Aokromes
2018-07-23 14:41:05 +02:00
parent da8b129857
commit 46be63ba71

View File

@@ -552,46 +552,6 @@ void Spell::EffectDummy(SpellEffIndex effIndex)
if (!unitTarget && !gameObjTarget && !itemTarget)
return;
// selection by spell family
switch (m_spellInfo->SpellFamilyName)
{
case SPELLFAMILY_PALADIN:
switch (m_spellInfo->Id)
{
case 31789: // Righteous Defense (step 1)
{
// Clear targets for eff 1
for (std::list<TargetInfo>::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
ihit->effectMask &= ~(1<<1);
// not empty (checked), copy
Unit::AttackerSet attackers = unitTarget->getAttackers();
// remove invalid attackers
for (Unit::AttackerSet::iterator aItr = attackers.begin(); aItr != attackers.end();)
if (!(*aItr)->IsValidAttackTarget(m_caster))
attackers.erase(aItr++);
else
++aItr;
// selected from list 3
uint32 maxTargets = std::min<uint32>(3, attackers.size());
for (uint32 i = 0; i < maxTargets; ++i)
{
Unit* attacker = Trinity::Containers::SelectRandomContainerElement(attackers);
AddUnitTarget(attacker, 1 << 1);
attackers.erase(attacker);
}
// now let next effect cast spell at each target.
return;
}
}
break;
default:
break;
}
// pet auras
if (m_caster->GetTypeId() == TYPEID_PLAYER)
{