mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-19 17:05:44 +01:00
Core/Spells: Fixed TARGET_UNIT_DRIVER selection and possible problems with Righteous Defense target count
This commit is contained in:
@@ -2370,7 +2370,7 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur)
|
||||
break;
|
||||
case TARGET_UNIT_DRIVER:
|
||||
if (Unit * driver = m_targets.getUnitTarget())
|
||||
if (driver->IsOnVehicle(driver))
|
||||
if (driver->IsOnVehicle(m_caster))
|
||||
AddUnitTarget(driver, i);
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -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