mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-26 11:52:32 +01:00
Core/Spells: Fixed Righteous Defense crash caused by modifying target list inside effect handler
* Already handled in a script
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user