Advertisement
Guest User

Untitled

a guest
Aug 18th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. void FilterTargets(std::list<WorldObject*>& targetsList)
  2. {
  3. if (!GetCaster())
  4. return;
  5.  
  6. targetMaxCount = GetCaster()->GetMap()->GetPlayerCount();
  7.  
  8. if (targetMaxCount < 15)
  9. targetMaxCount = 2;
  10. else if (targetMaxCount < 25)
  11. targetMaxCount = 4;
  12. else
  13. targetMaxCount = 6;
  14.  
  15. std::list<Player*> playerList;
  16. for (auto const& object : targetsList)
  17. {
  18. if (Player* player = Unit::GetPlayer(*GetCaster(), object->GetGUID()))
  19. if (!player->isInTankSpec())
  20. playerList.push_back(player);
  21. }
  22.  
  23. while (playerList.size() > 1)
  24. {
  25. Player* playerA = Trinity::Containers::SelectRandomContainerElement(playerList);
  26. playerList.remove(playerA);
  27. Player* playerB = Trinity::Containers::SelectRandomContainerElement(playerList);
  28. playerList.remove(playerB);
  29. if (playerA && playerB)
  30. {
  31. playerA->CastSpell(playerB, 208910, true);
  32. playerB->CastSpell(playerA, 208915, true);
  33. }
  34. count += 2;
  35. if (count >= targetMaxCount)
  36. break;
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement