Guest User

Syndra Combo

a guest
Oct 24th, 2013
5,823
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.35 KB | None | 0 0
  1. --[[
  2.     Follow while combo:
  3.         0 for Dont Follow
  4.         1 for Follow the mouse
  5. ]]
  6.  
  7. if myHero.charName ~= "Syndra" then return end
  8.  
  9. require 'AoESkillshotPosition'
  10.  
  11. local qRange = 800
  12. local wRange = 925
  13. local eRange = 650
  14. local rRange = 675
  15. local enemyMinions = {}
  16. local ultDmg = {90, 135, 180}
  17. local wWait, nextdelay, balls, qX, qZ, qCreated = 0, 0, 0, 0, 0, 0
  18. local DFGSlot = nil
  19.  
  20. local qDelay = 600
  21.  
  22. local QREADY, WREADY, EREADY, RREADY, DFGREADY = false, false, false, false, false
  23.  
  24. function OnLoad()
  25.     HConfig = scriptConfig("Syndra Combo", "SyndraCombo")
  26.     HConfig:addParam("scriptActive", "Combo", SCRIPT_PARAM_ONKEYDOWN, false, 32)
  27.     HConfig:addParam("stun", "Stun", SCRIPT_PARAM_ONKEYDOWN, false, 84)
  28.     HConfig:addParam("following", "Follow while combo", SCRIPT_PARAM_SLICE, 0, 0, 1)
  29.    
  30.     for i=1, heroManager.iCount do
  31.         local enemy = heroManager:GetHero(i)
  32.         if enemy.team ~= myHero.team then
  33.             HConfig:addParam("ult"..enemy.charName, "Ult and DFG on "..enemy.charName, SCRIPT_PARAM_ONOFF, true)
  34.         end
  35.     end
  36.    
  37.     HConfig:permaShow("stun")
  38.     HConfig:permaShow("scriptActive")
  39.    
  40.     enemyMinions = minionManager(MINION_ENEMY, wRange, myHero, MINION_SORT_HEALTH_DES)
  41.    
  42.     PrintChat(" >> Syndra Combo by HunteR")
  43. end
  44.  
  45. function getEnemyMinion()
  46.     for i, minion in pairs(enemyMinions.objects) do
  47.         if minion ~= nil and minion.valid then
  48.             return minion
  49.         end
  50.     end
  51.     return nil
  52. end
  53.  
  54. function getBall()
  55.     local ret = nil
  56.     if GetTickCount() > nextdelay then
  57.         balls = 0
  58.         for i = 1, objManager.maxObjects do
  59.             local object = objManager:getObject(i)
  60.             if object then
  61.                 if GetDistance(object) < rRange and string.find(string.lower(object.name), "darksphere") and string.find(string.lower(object.name), "_idle") then
  62.                     balls = balls + 1
  63.                     if ret == nil then ret = object end
  64.                 end
  65.             end
  66.         end
  67.         if ret == nil then ret = "none" end
  68.         nextdelay = GetTickCount() + 100
  69.     end
  70.     return ret
  71. end
  72.  
  73. function OnTick()
  74.     if myHero.dead then
  75.         return
  76.     end
  77.    
  78.     QREADY = (myHero:CanUseSpell(_Q) == READY)
  79.     WREADY = (myHero:CanUseSpell(_W) == READY)
  80.     EREADY = (myHero:CanUseSpell(_E) == READY)
  81.     RREADY = (myHero:CanUseSpell(_R) == READY)
  82.     DFGSlot = GetInventorySlotItem(3128)
  83.     DFGREADY = (DFGSlot ~= nil and myHero:CanUseSpell(DFGSlot) == READY)
  84.    
  85.     local spellR = myHero:GetSpellData(_R)
  86.     if spellR.level == 3 then rRange = 750 end
  87.    
  88.     if HConfig.scriptActive then combo("Combo") end
  89.     if HConfig.stun then combo("Stun") end
  90. end
  91.  
  92. function OnProcessSpell(unit, spell)
  93.     if unit.name == myHero.name then
  94.         if spell.name == "SyndraQ" then
  95.             qCreated = os.clock() + 1
  96.             qX, qZ = spell.endPos.x, spell.endPos.z
  97.         end
  98.     end
  99. end
  100.  
  101. function combo(typeC)
  102.     local focusEnemy = nil
  103.     local minimumHit = -1
  104.     local lowPriority = false
  105.    
  106.     local stunEnemy = nil
  107.     local minimumDistance = -1
  108.    
  109.     for i=1, heroManager.iCount do
  110.         local target = heroManager:GetHero(i)
  111.         if ValidTarget(target, 1000) then
  112.             local dmg = getDmg("Q", target, myHero)
  113.             local hits = (target.health / dmg)
  114.             if minimumHit == -1 or (hits < minimumHit and HConfig["ult"..target.charName]) or hits <= 1.05 or (not lowPriority and minimumHit > 1.05) then
  115.                 focusEnemy = target
  116.                 minimumHit = hits
  117.                 lowPriority = HConfig["ult"..target.charName]
  118.             end
  119.            
  120.             local distancetoStun = GetDistance(target)
  121.             if minimumDistance == -1 or distancetoStun < minimumDistance then
  122.                 stunEnemy = target
  123.                 minimumDistance = distancetoStun
  124.             end
  125.         end
  126.     end
  127.    
  128.     if focusEnemy ~= nil or (stunEnemy ~= nil and typeC == "Stun") then
  129.         if typeC == "Stun" then
  130.             focusEnemy = stunEnemy
  131.         end
  132.        
  133.         local spellW = myHero:GetSpellData(_W)
  134.        
  135.         if QREADY then
  136.             local Qprediction = GetPredictionPos(focusEnemy, qDelay)
  137.             local dPredict = GetDistance(Qprediction)
  138.             local qHit = false
  139.             if EREADY then
  140.                 if (dPredict < eRange) then
  141.                     qHit = true
  142.                 else
  143.                     local xQ = myHero.x + (eRange / dPredict) * (Qprediction.x - myHero.x)
  144.                     local zQ = myHero.z + (eRange / dPredict) * (Qprediction.z - myHero.z)
  145.                     CastSpell(_Q, xQ, zQ)
  146.                     return
  147.                 end
  148.             elseif dPredict < qRange then
  149.                 qHit = true
  150.             end
  151.            
  152.             if qHit then
  153.                 local spellPos = GetAoESpellPosition(175, focusEnemy, qDelay)
  154.                 CastSpell(_Q, spellPos.x, spellPos.z)
  155.                 return
  156.             end
  157.         end
  158.        
  159.         if EREADY and qCreated > os.clock() then
  160.             local obj2 = {}
  161.             obj2.x = qX
  162.             obj2.z = qZ
  163.            
  164.             if GetDistance(myHero, obj2) < eRange then
  165.                 CastSpell(_E, qX, qZ)
  166.                 wWait = GetTickCount() + 700
  167.                 return
  168.             else
  169.                 myHero:MoveTo(qX, qZ)
  170.                 return
  171.             end
  172.         end
  173.        
  174.         if typeC == "Combo" then
  175.             if DFGREADY and GetDistance(focusEnemy) < 750 and HConfig["ult"..focusEnemy.charName] then
  176.                 CastSpell(DFGSlot, focusEnemy)
  177.                 return
  178.             end
  179.            
  180.             if WREADY and GetTickCount() > wWait then
  181.                 local wGetX, wGetZ = nil, nil
  182.                
  183.                 if spellW.name == "SyndraW" and not EREADY then
  184.                     enemyMinions:update()
  185.                     local minion = getEnemyMinion()
  186.                    
  187.                     if minion ~= nil then wGetX, wGetZ = minion.x, minion.z end
  188.                    
  189.                     if wGetX == nil then
  190.                         local ball = getBall()
  191.                         if ball == nil then return end
  192.                         if ball ~= "none" then wGetX, wGetZ = ball.x, ball.z end
  193.                     end
  194.                    
  195.                     if wGetX ~= nil then
  196.                         CastSpell(_W, wGetX, wGetZ)
  197.                         wWait = GetTickCount() + 300
  198.                         return
  199.                     end
  200.                 elseif spellW.name ~= "SyndraW" then
  201.                     local spellPos = GetAoESpellPosition(200, focusEnemy, 800)
  202.                     CastSpell(_W, spellPos.x, spellPos.z)
  203.                 end
  204.             end
  205.            
  206.            
  207.             local AlwaysUltimate = true
  208.             if CountEnemyHeroInRange(1000) > 3 then
  209.                 if getDmg("Q", focusEnemy, myHero) >= focusEnemy.health then
  210.                     AlwaysUltimate = false
  211.                 end
  212.             end
  213.            
  214.             if RREADY and GetDistance(focusEnemy) < rRange and HConfig["ult"..focusEnemy.charName] and AlwaysUltimate then
  215.                 if getBall() ~= nil then
  216.                     local ballsAll = 3 + balls
  217.                     local spellR = myHero:GetSpellData(_R)
  218.                     local RdmgAll = myHero:CalcMagicDamage(focusEnemy, ((ultDmg[spellR.level] * ballsAll) + (ballsAll * 0.2 * myHero.ap)))
  219.                     local percentDmg = RdmgAll / focusEnemy.health
  220.                    
  221.                     if percentDmg > 1 and (percentDmg < 5 or (myHero.health / myHero.maxHealth) < 0.25) then
  222.                         CastSpell(_R, focusEnemy)
  223.                         return
  224.                     end
  225.                 end
  226.             end
  227.         end
  228.     end
  229.    
  230.     if HConfig.following == 1 and typeC == "Combo" then
  231.         myHero:MoveTo(mousePos.x, mousePos.z)
  232.     end
  233. end
Advertisement
Add Comment
Please, Sign In to add comment