Advertisement
Guest User

Untitled

a guest
May 26th, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.61 KB | None | 0 0
  1. function GetBestCombo(target)
  2.     if not ValidTarget(target) or champ == nil then return false, false, false, false, 0 end
  3.     local q = {false}
  4.     local w = {false}
  5.     local e = {false}
  6.     local r = {false}
  7.     local damagetable = PredictedDamage[target.networkID]
  8.     if damagetable ~= nil then
  9.         local time = damagetable[6]
  10.         if os.clock() - time <= RefreshTime  then
  11.             return damagetable[1], damagetable[2], damagetable[3], damagetable[4], damagetable[5]
  12.         else
  13.             if champ.Q and champ.Q.IsReady() then q = {false, true} end
  14.             if champ.W and champ.W.IsReady() then w = {false, true} end
  15.             if champ.E and champ.E.IsReady() then e = {false, true} end
  16.             if champ.R and champ.R.IsReady() then r = {false, true} end
  17.             local bestdmg = 0
  18.             local best = {champ.Q.IsReady(), champ.W.IsReady(), champ.E.IsReady(), champ.R.IsReady()}
  19.             local dmg, mana = champ:GetComboDamage(target, champ.Q.IsReady(), champ.W.IsReady(), champ.E.IsReady(), champ.R.IsReady())
  20.             bestdmg = dmg
  21.             if dmg > target.health then
  22.                 for qCount = 1, #q do
  23.                     for wCount = 1, #w do
  24.                         for eCount = 1, #e do
  25.                             for rCount = 1, #r do
  26.                                 local d, m = champ:GetComboDamage(target, q[qCount], w[wCount], e[eCount], r[rCount])
  27.                                 if d >= target.health and myHero.mana >= m then
  28.                                     if d < bestdmg then
  29.                                         bestdmg = d
  30.                                         best = {q[qCount], w[wCount], e[eCount], r[rCount]}
  31.                                     end
  32.                                 end
  33.                             end
  34.                         end
  35.                     end
  36.                 end
  37.                 --return best[1], best[2], best[3], best[4], bestdmg
  38.                 damagetable[1] = best[1]
  39.                 damagetable[2] = best[2]
  40.                 damagetable[3] = best[3]
  41.                 damagetable[4] = best[4]
  42.                 damagetable[5] = bestdmg
  43.                 damagetable[6] = os.clock()
  44.             else
  45.                 local table2 = {false,false,false,false}
  46.                 local bestdmg, mana = champ:GetComboDamage(target, false, false, false, false)
  47.                 for qCount = 1, #q do
  48.                     for wCount = 1, #w do
  49.                         for eCount = 1, #e do
  50.                             for rCount = 1, #r do
  51.                                 local d, m = champ:GetComboDamage(target, q[qCount], w[wCount], e[eCount], r[rCount])
  52.                                 if d > bestdmg and myHero.mana >= m then
  53.                                     table2 = {q[qCount],w[wCount],e[eCount],r[rCount]}
  54.                                     bestdmg = d
  55.                                 end
  56.                             end
  57.                         end
  58.                     end
  59.                 end
  60.                 --return table2[1],table2[2],table2[3],table2[4], bestdmg
  61.                 damagetable[1] = table2[1]
  62.                 damagetable[2] = table2[2]
  63.                 damagetable[3] = table2[3]
  64.                 damagetable[4] = table2[4]
  65.                 damagetable[5] = bestdmg
  66.                 damagetable[6] = os.clock()
  67.             end
  68.             return damagetable[1], damagetable[2], damagetable[3], damagetable[4], damagetable[5]
  69.         end
  70.     else
  71.         PredictedDamage[target.networkID] = {false, false, false, false, 0, os.clock() - RefreshTime * 2}
  72.         return GetBestCombo(target)
  73.     end
  74. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement