mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-25 19:31:59 +01:00
Core/Spells: Fixed TARGET_UNIT_DRIVER selection and possible problems with Righteous Defense target count
This commit is contained in:
@@ -1390,11 +1390,12 @@ void Spell::EffectDummy(SpellEffIndex effIndex)
|
||||
Unit::AttackerSet attackers = unitTarget->getAttackers();
|
||||
|
||||
// selected from list 3
|
||||
for (uint32 i = 0; i < std::min(size_t(3), attackers.size()); ++i)
|
||||
uint32 maxTargets = std::min<uint32>(3, attackers.size());
|
||||
for (uint32 i = 0; i < maxTargets; ++i)
|
||||
{
|
||||
Unit::AttackerSet::iterator aItr = attackers.begin();
|
||||
std::advance(aItr, rand() % attackers.size());
|
||||
AddUnitTarget((*aItr), 1);
|
||||
std::advance(aItr, urand(0, attackers.size() - 1));
|
||||
AddUnitTarget(*aItr, 1);
|
||||
attackers.erase(aItr);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user