Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void FilterTargets(std::list<WorldObject*>& targetsList)
- {
- if (!GetCaster())
- return;
- targetMaxCount = GetCaster()->GetMap()->GetPlayerCount();
- if (targetMaxCount < 15)
- targetMaxCount = 2;
- else if (targetMaxCount < 25)
- targetMaxCount = 4;
- else
- targetMaxCount = 6;
- std::list<Player*> playerList;
- for (auto const& object : targetsList)
- {
- if (Player* player = Unit::GetPlayer(*GetCaster(), object->GetGUID()))
- if (!player->isInTankSpec())
- playerList.push_back(player);
- }
- while (playerList.size() > 1)
- {
- Player* playerA = Trinity::Containers::SelectRandomContainerElement(playerList);
- playerList.remove(playerA);
- Player* playerB = Trinity::Containers::SelectRandomContainerElement(playerList);
- playerList.remove(playerB);
- if (playerA && playerB)
- {
- playerA->CastSpell(playerB, 208910, true);
- playerB->CastSpell(playerA, 208915, true);
- }
- count += 2;
- if (count >= targetMaxCount)
- break;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement