Advertisement
Guest User

Untitled

a guest
May 25th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.06 KB | None | 0 0
  1. function Orianna:FindBestLocationToQ(target)
  2. if self.BallHolder ~= nil and self.BallHolder.isValid then
  3. local points = {}
  4. local targets = {}
  5.  
  6. local result = _G.Prediction.GetPrediction(target, self.q, self.BallHolder.position)
  7. if result.targetPosition and result.hitChance > 0 then
  8. table.insert(points, result.targetPosition)
  9. table.insert(targets, target)
  10. end
  11.  
  12. for i, enemy in ipairs(ObjectManager:GetEnemyHeroes()) do
  13. if ValidTarget(enemy, self.q.range + 370) and enemy.networkID ~= target.networkID then
  14. result = _G.Prediction.GetPrediction(enemy, self.q, self.BallHolder.position)
  15. if result.targetPosition and result.hitChance > 0 then
  16. table.insert(points, result.targetPosition)
  17. table.insert(targets, enemy)
  18. end
  19. end
  20. end
  21.  
  22.  
  23. for o = 1, 5 do
  24. local MECa = MEC(points)
  25. local Circle = MECa:Compute()
  26.  
  27. if Circle.radius <= 370 and #points >= 3 and myHero.spellbook:CanUseSpell(3) == 0 then
  28. return Circle.center, 3
  29. end
  30.  
  31. if Circle.radius <= 240 and #points >= 2 and myHero.spellbook:CanUseSpell(1) == 0 then
  32. return Circle.center, 2
  33. end
  34.  
  35. if #points == 1 then
  36. return Circle.center, 1
  37. elseif Circle.radius <= (self.q.radius + 50) and #points >= 1 then
  38. return Circle.center, 2
  39. end
  40.  
  41. local Dist = -1
  42. local MyPoint = points[1]
  43. local index = 0
  44.  
  45. for i=2, #points, 1 do
  46. if GetDistance(points[i], MyPoint) >= Dist then
  47. Dist = GetDistance(points[i], MyPoint)
  48. index = i
  49. end
  50. end
  51. if index > 0 then
  52. table.remove(points, index)
  53. end
  54. end
  55. end
  56. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement