AnonymousBOL

range checks, casting spells on summoners rift :3

Oct 12th, 2013
265
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 10.46 KB | None | 0 0
  1. if GetGame().map.name == "The Crystal Scar" then -- LOAD LOGIC FOR DOMINION
  2.     if myHero.charName == "Darius" then
  3.         local drawQrange = true        -- Draw the range of Q
  4.         local useExecutioner = true     -- calculate Executioner or not? True / False
  5.         local havocPoints = 3           -- how many points in Havoc? 0 / 1 / 2 / 3
  6.         local drawUltiInfo = true
  7.         local smoothMultR = 1.0
  8.         local smoothStaticR = -2
  9.         local smoothStaticPerLvl = true
  10.         local smoothDisabledBeforeLvl = 12
  11.         local targetFindRange = 80        -- This is a distance between targeted spell coordinates and your real target's coordinates.
  12.         local qBladeRange = 270
  13.         local qRange = 425
  14.         local eRange = 500 -- lowered since most of the times enemies goes out of the E range while you're casting it
  15.         local rRange = 475
  16.         local wDmgRatioPerLvl = 0.2
  17.         local rDmgRatioPerHemo = 0.2
  18.         local hemoTimeOut = 5000
  19.         local enemyToAttack = nil
  20.         local enemyTable = {}
  21.         local hemoTable = {
  22.             [1] = "darius_hemo_counter_01.troy",
  23.             [2] = "darius_hemo_counter_02.troy",
  24.             [3] = "darius_hemo_counter_03.troy",
  25.             [4] = "darius_hemo_counter_04.troy",
  26.             [5] = "darius_hemo_counter_05.troy",
  27.         }
  28.         local damageTable = {
  29.             Q = { base = 35, baseScale = 35, adRatio = 0.7, },
  30.             R = { base = 70, baseScale = 90, adRatio = 0.75, },
  31.         }
  32.         local checkBuffForUlti = {
  33.             {name="Tryndamere", spellName="undyingRage", enabled=false, spellType=0, spellLevel=1, duration=5000, spellParticle="undyingrage_glow"},
  34.             {name="Kayle", spellName="eyeForEye", enabled=false, spellType=0, spellLevel=1, duration=3000, spellParticle="eyeforaneye"},
  35.             {name="Zilean", spellName="nickOfTime", enabled=false, spellType=0, spellLevel=1, duration=7000, spellParticle="nickoftime_tar"},
  36.             {name="Nocturne", spellName="shroudOfDarkness", enabled=false, spellType=0, spellLevel=1,duration=1500,spellParticle="nocturne_shroudofdarkness_shield_cas_02"},
  37.             {name="Blitzcrank", spellName="manaBarrier", enabled=false, spellType=1, spellLevel=1, duration=10000, spellParticle="manabarrier"},
  38.             {name="Sivir", spellName="spellShield", enabled=false, spellType=0, spellLevel=1, duration=3000, spellParticle="spellblock_eff"}
  39.         }
  40.         for i=0, heroManager.iCount, 1 do
  41.             local playerObj = heroManager:GetHero(i)
  42.             if playerObj and playerObj.team ~= player.team then
  43.                 playerObj.hemo = { tick = 0, count = 0, }
  44.                 playerObj.pauseTickQ = 0
  45.                 playerObj.pauseTickR = 0
  46.                 playerObj.canBeUlted = true
  47.                 playerObj.immuneTimeout = 0
  48.                 playerObj.shield = 0
  49.                 table.insert(enemyTable,playerObj)
  50.                 for i=1, #checkBuffForUlti, 1 do
  51.                     if checkBuffForUlti[i].name == playerObj.charName then
  52.                         checkBuffForUlti[i].enabled = true
  53.                         PrintChat(checkBuffForUlti[i].spellName.." check enabled")
  54.                     end
  55.                 end
  56.             end
  57.         end
  58.  
  59.         function OnCreateObj(obj)
  60.             if obj then
  61.                 if string.find(string.lower(obj.name),"darius_hemo_counter") then
  62.                     for i, enemy in pairs(enemyTable) do
  63.                         if enemy and not enemy.dead and enemy.visible and GetDistance2D(enemy,obj) <= targetFindRange then
  64.                             for k, hemo in pairs(hemoTable) do
  65.                                 if obj.name == hemo then
  66.                                     enemy.hemo.tick = GetTickCount()
  67.                                     enemy.hemo.count = k
  68.                                     --PrintFloatText(enemy,21,k .. " Bleedings")
  69.                                 end
  70.                             end
  71.                         end
  72.                     end
  73.                 end
  74.             end
  75.         end
  76.  
  77.         function ChampionInfo(champion)
  78.             local results = {}
  79.             for i=1, #checkBuffForUlti, 1 do
  80.                 if checkBuffForUlti[i].name == champion or checkBuffForUlti[i].name == "*" then
  81.                     table.insert(results, checkBuffForUlti[i])
  82.                 end
  83.             end
  84.             return results
  85.         end
  86.  
  87.         function CanUltiEnemy(target)
  88.             for i, enemy in pairs(enemyTable) do
  89.                 if target.networkID == enemy.networkID then
  90.                     if enemy.canBeUlted == false and enemy.immuneTimeout < GetTickCount() then
  91.                         enemy.canBeUlted = true
  92.                         enemy.immuneTimeout = 0
  93.                     end
  94.                     return enemy.canBeUlted
  95.                 end
  96.             end
  97.         end
  98.  
  99.         function GetShieldValue(enemy,spellName)
  100.             if spellName == "manaBarrier" then
  101.                 return enemy.mana*0.5
  102.             end
  103.         end
  104.  
  105.         function GetDuration(spellName,spellLevel)
  106.             if spellName == "undyingRage" then return 5000 end
  107.             if spellName == "eyeForEye" then return 1500+500*spellLevel end
  108.             if spellName == "nickOfTime" then return 7000 end
  109.             if spellName == "shroudOfDarkness" then return 1500 end
  110.         end
  111.        
  112.         function OnTick()
  113.             if myHero.health < (myHero.maxHealth*0.3) then return end
  114.             local rDmg = (damageTable.R.base + (damageTable.R.baseScale*player:GetSpellData(_R).level) +
  115.                     damageTable.R.adRatio*player.addDamage) * smoothMultR
  116.             if player.level > smoothDisabledBeforeLvl then
  117.                 local rDmgInc = smoothStaticR
  118.                 if smoothStaticPerLvl == true then
  119.                     rDmgInc = rDmgInc * player.level
  120.                 end
  121.                 rDmg = rDmg + rDmgInc
  122.             end
  123.             local qDmg = damageTable.Q.base + (damageTable.Q.baseScale*player:GetSpellData(_Q).level) +
  124.                     damageTable.Q.adRatio*player.addDamage
  125.             for i, enemy in pairs(enemyTable) do
  126.                 local enemyHP = enemy.health + enemy.shield
  127.                 if (GetTickCount() - enemy.hemo.tick > hemoTimeOut) or (enemy and enemy.dead) then enemy.hemo.count = 0 end
  128.                 if enemy and not enemy.dead and enemy.visible == true and enemy.bTargetable then
  129.                     WReady = (myHero:CanUseSpell(_W) == READY and GetDistance(enemy) < 200)
  130.                     if WReady then CastSpell(_W) end
  131.                     local scale = 1 + havocPoints*0.005
  132.                     if useExecutioner and enemyHP < enemy.maxHealth*0.4 then scale = scale + 0.06 end
  133.                     qDmg = player:CalcDamage(enemy,qDmg)
  134.                     if player:CanUseSpell(_Q) == READY and GetDistance(enemy) < qRange then CastSpell(_Q) end
  135.                     if player:CanUseSpell(_E) == READY and GetDistance(enemy) < eRange then CastSpell(_E,enemy.x,enemy.z) end
  136.                     --if player:CanUseSpell(_E) == READY and GetDistance(enemy) < eRange then CastSpell(_W) end
  137.                     --if GetTickCount() - enemy.pauseTickQ >= 500 and GetTickCount() - enemy.pauseTickR >= 200 then
  138.                         if qDmg * scale > enemyHP and player:CanUseSpell(_Q) == READY and GetDistance(enemy) < qRange then
  139.                             CastSpell(_Q)
  140.                             --enemy.pauseTickQ = GetTickCount()
  141.                         elseif ( qDmg * 1.5 ) * scale > enemyHP and player:CanUseSpell(_Q) == READY and GetDistance(enemy) < qRange and GetDistance(enemy) >= qBladeRange then
  142.                             CastSpell(_Q)
  143.                             --enemy.pauseTickQ = GetTickCount()
  144.                         elseif rDmg * ( 1.0 + rDmgRatioPerHemo * enemy.hemo.count ) > enemyHP and player:CanUseSpell(_R) == READY and GetDistance(enemy) < rRange and CanUltiEnemy(enemy) == true then
  145.                             CastSpell(_R,enemy)
  146.                             --enemy.pauseTickR = GetTickCount()
  147.                         end
  148.                             if player:GetSpellData(_R).level > 0 and player:GetDistance(enemy) < 3500 and drawUltiInfo == true then
  149.                             if CanUltiEnemy(enemy) == false then
  150.                                 --PrintFloatText(enemy,0,"IMMUNE")
  151.                             elseif rDmg * ( 1.0 + rDmgRatioPerHemo * enemy.hemo.count ) > enemyHP then
  152.                                 --PrintFloatText(enemy,0,"DUNK")
  153.                             else
  154.                                 --PrintFloatText(enemy,0,"" .. math.ceil(enemyHP - (rDmg * ( 1.0 + rDmgRatioPerHemo * enemy.hemo.count ))) .. " hp" .. " - " .. enemy.hemo.count)
  155.                             end
  156.                         end
  157.                     --end
  158.                 end
  159.             end
  160.         end
  161.         PrintChat("<font color='#E97FA5'>>> DARIUS DETECTED! LOGIC V2.</font>")
  162.     elseif myHero.charName == "XinZhao" then
  163.         local ts = TargetSelector(TARGET_LOW_HP,1000,false)
  164.         function OnTick()
  165.             if myHero.health < (myHero.maxHealth*0.25) then return end
  166.             ts:update()
  167.             if ts.target ~= nil and ts.target.dead == false and CountEnemyHeroInRange(1500) <= 3 then
  168.                 QReady = (myHero:CanUseSpell(_Q) == READY and GetDistance(ts.target) < 200)
  169.                 WReady = (myHero:CanUseSpell(_W) == READY and GetDistance(ts.target) < 200)
  170.                 EReady = (myHero:CanUseSpell(_E) == READY and GetDistance(ts.target) < 600)
  171.                 RReady = (myHero:CanUseSpell(_R) == READY and GetDistance(ts.target) < 185)
  172.                 if EReady then CastSpell(_E, ts.target) end
  173.                 if WReady then CastSpell(_W) end
  174.                 if QReady then CastSpell(_Q) end
  175.                 if RReady then CastSpell(_R) end
  176.             end
  177.         end
  178.         PrintChat("<font color='#E97FA5'>>> XINZHAO DETECTED! LOGIC V1.</font>")
  179.     -------------------------------------------------------------------------------------------------------------------
  180.  
  181.     elseif myHero.charName == "Katarina" then
  182.         local ts = TargetSelector(TARGET_LOW_HP,1000,false)
  183.         function OnTick()
  184.             if myHero.health < (myHero.maxHealth*0.25) then return end
  185.             ts:update()
  186.             if ts.target ~= nil and ts.target.dead == false then
  187.                 QReady = (myHero:CanUseSpell(_Q) == READY and GetDistance(ts.target) < 600)
  188.                 WReady = (myHero:CanUseSpell(_W) == READY and GetDistance(ts.target) < 200)
  189.                 EReady = (myHero:CanUseSpell(_E) == READY and GetDistance(ts.target) < 600)
  190.                 RReady = (myHero:CanUseSpell(_R) == READY and GetDistance(ts.target) < 300)
  191.                 if QReady then CastSpell(_Q, ts.target) end
  192.                 if EReady then CastSpell(_E, ts.target) end
  193.                 if WReady then CastSpell(_W) end
  194.                 if RReady then CastSpell(_R) end
  195.             end
  196.         end
  197.         PrintChat("<font color='#E97FA5'>>> KATARINA DETECTED! LOGIC V2.</font>")
  198.  
  199.     -------------------------------------------------------------------------------------------------------------------
  200.     else
  201.         PrintChat("<font color='#E97FA5'>>> "..myHero.charName.." is not supported.</font>")
  202.         PrintChat("<font color='#E97FA5'>>> Loading... Done!</font>")
  203.        
  204.         local ts = TargetSelector(TARGET_LOW_HP,1000,false)
  205.         function useSpell(ts, spell) -- Yes TRUS, its from your code ( your idea ). Thanks :p
  206.             if ts.target ~= nil and myHero:CanUseSpell(spell) == READY and myHero:GetSpellData(spell).range > GetDistance(myHero, ts.target) then
  207.                 CastSpell(spell, ts.target)
  208.                 CastSpell(spell, ts.target.x, ts.target.z)
  209.             end
  210.         end
  211.         function OnTick()
  212.             if myHero.health < (myHero.maxHealth*0.25) then return end
  213.             ts:update()
  214.             useSpell(ts, _Q)
  215.             useSpell(ts, _E)
  216.             useSpell(ts, _W)
  217.             useSpell(ts, _R)
  218.         end
  219.     end
  220. elseif GetGame().map.name == "Summoners Rift" then
  221.     -- Damn, people this is not bot for Summoners Rift, dont use it there. But whatever, it should use spells now.
  222.     local ts = TargetSelector(TARGET_LOW_HP,1000,false)
  223.     function useSpell(ts, spell)
  224.         if ts.target ~= nil and myHero:CanUseSpell(spell) == READY and myHero:GetSpellData(spell).range > GetDistance(myHero, ts.target) then
  225.             CastSpell(spell, ts.target)
  226.             CastSpell(spell, ts.target.x, ts.target.z)
  227.         end
  228.     end
  229.     function OnTick()
  230.         if myHero.health < (myHero.maxHealth*0.25) then return end
  231.         ts:update()
  232.         useSpell(ts, _Q)
  233.         useSpell(ts, _E)
  234.         useSpell(ts, _W)
  235.         useSpell(ts, _R)
  236.     end
  237. else
  238.     --fPrintChat("<font color='#E97FA5'>>> This map is not supported. QBot unloading!</font>")
  239. end
Advertisement
Add Comment
Please, Sign In to add comment