Advertisement
mwow

Darius Dunk BolStudio

Sep 15th, 2012
8,489
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 9.95 KB | None | 0 0
  1. --[[
  2.     Darius Dunk v0.35 by Lux - Modified by Mwow
  3.  
  4.     Changelog:
  5.     v0.35  Added Toggles for Ult and Q Harrass, added config menu, speed up ult usage
  6.     v0.34  different approach to avoid ultimate usage when enemy is immune
  7.            initial support to shield calculation
  8.         v0.33: added some stuff to smooth the ultimate dmg calculation
  9.         v0.32: added anivia's passive check
  10.         v0.31: added drawUltiInfo variable
  11.         v0.3: added blitzcrank's handler, various fix
  12.         v0.2: added trynda/blitz/zilean's ulti check
  13.  
  14.     based on
  15.     Darius Ownage
  16.     v1.1
  17.     written by Weee
  18.     Modified by Delusional Logic
  19. ]]
  20.  
  21.  
  22. if GetMyHero().charName ~= "Darius" then return end
  23.  
  24. require "AllClass"
  25.  
  26. --[[  Config  ]]
  27. local drawQrange = true        -- Draw the range of Q
  28. local useExecutioner = true     -- calculate Executioner or not? True / False
  29. local havocPoints = 3           -- how many points in Havoc? 0 / 1 / 2 / 3
  30. local drawUltiInfo = true
  31.  
  32. -- the R's dmg is multiplied with this value, 1.0 means nothing changes of course
  33. local smoothMultR = 1.0
  34. -- change to 0 if you don't want to smooth R's dmg calculation
  35. local smoothStaticR = -2
  36. -- -2 means that at lvl 18 the ultimate will be automatically casted on an enemy if his health is < than R's dmg-36
  37. -- if you put this to false then the dmg removed from R will be the static number written in smoothStaticR
  38. local smoothStaticPerLvl = true
  39. -- put to 0 if you don't want to disabled the ulti's smoother at all, I put this to 12 because I don't want to risk
  40. --  to lose in lane because the ulti isn't casted for like 12hp
  41. local smoothDisabledBeforeLvl = 12
  42.  
  43. --[[  Advanced Config  ]]
  44. local targetFindRange = 80        -- This is a distance between targeted spell coordinates and your real target's coordinates.
  45. local qBladeRange = 270
  46. local qRange = 425
  47. local eRange = 500 -- lowered since most of the times enemies goes out of the E range while you're casting it
  48. local rRange = 475
  49. local wDmgRatioPerLvl = 0.2
  50. local rDmgRatioPerHemo = 0.2
  51. local hemoTimeOut = 5000
  52.  
  53.  
  54. --[[  Globals  ]]
  55. local enemyToAttack = nil
  56. local enemyTable = {}
  57. local player = GetMyHero()
  58.  
  59. local hemoTable = {
  60.     [1] = "darius_hemo_counter_01.troy",
  61.     [2] = "darius_hemo_counter_02.troy",
  62.     [3] = "darius_hemo_counter_03.troy",
  63.     [4] = "darius_hemo_counter_04.troy",
  64.     [5] = "darius_hemo_counter_05.troy",
  65. }
  66.  
  67. local damageTable = {
  68.     Q = { base = 35, baseScale = 35, adRatio = 0.7, },
  69.     R = { base = 70, baseScale = 90, adRatio = 0.75, },
  70. }
  71.  
  72. local checkBuffForUlti = {
  73.     {name="Tryndamere", spellName="undyingRage", enabled=false, spellType=0, spellLevel=1, duration=5000, spellParticle="undyingrage_glow"},
  74.     {name="Kayle", spellName="eyeForEye", enabled=false, spellType=0, spellLevel=1, duration=3000, spellParticle="eyeforaneye"},
  75.     {name="Zilean", spellName="nickOfTime", enabled=false, spellType=0, spellLevel=1, duration=7000, spellParticle="nickoftime_tar"},
  76.     {name="Nocturne", spellName="shroudOfDarkness", enabled=false, spellType=0, spellLevel=1,duration=1500,spellParticle="nocturne_shroudofdarkness_shield_cas_02"},
  77.     {name="Blitzcrank", spellName="manaBarrier", enabled=false, spellType=1, spellLevel=1, duration=10000, spellParticle="manabarrier"},
  78.     {name="Sivir", spellName="spellShield", enabled=false, spellType=0, spellLevel=1, duration=3000, spellParticle="spellblock_eff"}
  79. }
  80.  
  81. for i=0, heroManager.iCount, 1 do
  82.     local playerObj = heroManager:GetHero(i)
  83.     if playerObj and playerObj.team ~= player.team then
  84.         playerObj.hemo = { tick = 0, count = 0, }
  85.         playerObj.pauseTickQ = 0
  86.         playerObj.pauseTickR = 0
  87.         playerObj.canBeUlted = true
  88.         playerObj.immuneTimeout = 0
  89.         playerObj.shield = 0
  90.         table.insert(enemyTable,playerObj)
  91.         for i=1, #checkBuffForUlti, 1 do
  92.             if checkBuffForUlti[i].name == playerObj.charName then
  93.                 checkBuffForUlti[i].enabled = true
  94.                 PrintChat(checkBuffForUlti[i].spellName.." check enabled")
  95.             end
  96.         end
  97.     end
  98. end
  99.  
  100. --[[   Code   ]]
  101. function OnLoad()
  102.     config = scriptConfig("Darius", "Darius Dunk")
  103.     config:addParam("eActive", "Apprehend", SCRIPT_PARAM_ONKEYDOWN, false, string.byte("S"))
  104.     config:addParam("drawQrange", "Draw Q Range", SCRIPT_PARAM_ONOFF, true)
  105.     config:addParam("toggleUlt", "Toggle Auto Ultimate", SCRIPT_PARAM_ONKEYTOGGLE, true, string.byte("O"))
  106.     config:addParam("toggleQ", "Toggle Decimate harrass", SCRIPT_PARAM_ONKEYTOGGLE, true, string.byte("P"))
  107.     config:addParam("qHarrass", "Decimate Harrass", SCRIPT_PARAM_ONKEYDOWN, false, 32)
  108.     config:permaShow("toggleUlt")
  109.     config:permaShow("toggleQ")
  110. end
  111.  
  112. function OnWndMsg(msg, keycode )
  113.     SC__OnWndMsg(msg, keycode)
  114. end
  115.  
  116. function ChampionInfo(champion)
  117.     local results = {}
  118.     for i=1, #checkBuffForUlti, 1 do
  119.         if checkBuffForUlti[i].name == champion or checkBuffForUlti[i].name == "*" then
  120.             table.insert(results, checkBuffForUlti[i])
  121.         end
  122.     end
  123.     return results
  124. end
  125.  
  126. function CanUltiEnemy(target)
  127.     for i, enemy in pairs(enemyTable) do
  128.         if target.networkID == enemy.networkID then
  129.             if enemy.canBeUlted == false and enemy.immuneTimeout < GetTickCount() then
  130.                 enemy.canBeUlted = true
  131.                 enemy.immuneTimeout = 0
  132.             end
  133.             return enemy.canBeUlted
  134.         end
  135.     end
  136. end
  137.  
  138. function GetShieldValue(enemy,spellName)
  139.     if spellName == "manaBarrier" then
  140.         return enemy.mana*0.5
  141.     end
  142. end
  143.  
  144. function GetDuration(spellName,spellLevel)
  145.     if spellName == "undyingRage" then return 5000 end
  146.     if spellName == "eyeForEye" then return 1500+500*spellLevel end
  147.     if spellName == "nickOfTime" then return 7000 end
  148.     if spellName == "shroudOfDarkness" then return 1500 end
  149. end
  150.  
  151. function OnTick()
  152.     local rDmg = (damageTable.R.base + (damageTable.R.baseScale*player:GetSpellData(_R).level) +
  153.             damageTable.R.adRatio*player.addDamage) * smoothMultR
  154.     if player.level > smoothDisabledBeforeLvl then
  155.         local rDmgInc = smoothStaticR
  156.         if smoothStaticPerLvl == true then
  157.             rDmgInc = rDmgInc * player.level
  158.         end
  159.         rDmg = rDmg + rDmgInc
  160.     end
  161.     local qDmg = damageTable.Q.base + (damageTable.Q.baseScale*player:GetSpellData(_Q).level) +
  162.             damageTable.Q.adRatio*player.addDamage
  163.     for i, enemy in pairs(enemyTable) do
  164.         local enemyHP = enemy.health + enemy.shield
  165.         if (GetTickCount() - enemy.hemo.tick > hemoTimeOut) or (enemy and enemy.dead) then enemy.hemo.count = 0 end
  166.         if enemy and not enemy.dead and enemy.visible == true and enemy.bTargetable and enemy.bInvulnerable == 0 then
  167.             local scale = 1 + havocPoints*0.005
  168.             if useExecutioner and enemyHP < enemy.maxHealth*0.4 then scale = scale + 0.06 end
  169.             qDmg = player:CalcDamage(enemy,qDmg)
  170.             if (config.qHarrass or config.toggleQ) and player:CanUseSpell(_Q) == READY and GetDistance(enemy) < qRange then CastSpell(_Q) end
  171.             if config.eActive and player:CanUseSpell(_E) == READY and GetDistance(enemy) < eRange then CastSpell(_E,enemy.x,enemy.z) end
  172.             --if GetTickCount() - enemy.pauseTickQ >= 500 and GetTickCount() - enemy.pauseTickR >= 200 then
  173.                 if qDmg * scale > enemyHP and player:CanUseSpell(_Q) == READY and GetDistance(enemy) < qRange then
  174.                     CastSpell(_Q)
  175.                     --enemy.pauseTickQ = GetTickCount()
  176.                 elseif ( qDmg * 1.5 ) * scale > enemyHP and player:CanUseSpell(_Q) == READY and GetDistance(enemy) < qRange and GetDistance(enemy) >= qBladeRange then
  177.                     CastSpell(_Q)
  178.                     --enemy.pauseTickQ = GetTickCount()
  179.                 elseif config.toggleUlt and rDmg * ( 1.0 + rDmgRatioPerHemo * enemy.hemo.count ) > enemyHP and player:CanUseSpell(_R) == READY and GetDistance(enemy) < rRange and CanUltiEnemy(enemy) == true then
  180.                     CastSpell(_R,enemy)
  181.                     --enemy.pauseTickR = GetTickCount()
  182.                 end
  183.  
  184.                 if player:GetSpellData(_R).level > 0 and player:GetDistance(enemy) < 3500 and drawUltiInfo == true then
  185.                     if CanUltiEnemy(enemy) == false then
  186.                         PrintFloatText(enemy,0,"IMMUNE")
  187.                     elseif rDmg * ( 1.0 + rDmgRatioPerHemo * enemy.hemo.count ) > enemyHP then
  188.                         PrintFloatText(enemy,0,"DUNK")
  189.                     else
  190.                         PrintFloatText(enemy,0,"" .. math.ceil(enemyHP - (rDmg * ( 1.0 + rDmgRatioPerHemo * enemy.hemo.count ))) .. " hp" .. " - " .. enemy.hemo.count)
  191.                     end
  192.                 end
  193.             --end
  194.         end
  195.     end
  196. end
  197.  
  198. function OnCreateObj( object )
  199.     if object then
  200.         for i=1, #checkBuffForUlti, 1 do
  201.             if string.find(string.lower(object.name),checkBuffForUlti[i].spellParticle) and checkBuffForUlti[i].enabled == true then
  202.                 for i, enemy in pairs(enemyTable) do
  203.                     if GetDistance2D(enemy,object) < 30 then
  204.                         if checkBuffForUlti[i].spellType == 0 then
  205.                             enemy.canBeUlted = false
  206.                             enemy.immuneTimeout = GetTickCount()+checkBuffForUlti[i].duration
  207.                         elseif checkBuffForUlti[i].spellType == 1 then
  208.                             enemy.shield = enemy.shield + getShieldValue(checkBuffForUlti[i].spellName)
  209.                         end
  210.                     end
  211.                 end
  212.             end
  213.         end
  214.        
  215.         if string.find(string.lower(object.name),"darius_hemo_counter") then
  216.             for i, enemy in pairs(enemyTable) do
  217.                 if enemy and not enemy.dead and enemy.visible and GetDistance2D(enemy,object) <= targetFindRange then
  218.                     for k, hemo in pairs(hemoTable) do
  219.                         if object.name == hemo then
  220.                             enemy.hemo.tick = GetTickCount()
  221.                             enemy.hemo.count = k
  222.                             PrintFloatText(enemy,21,k .. " Bleedings")
  223.                         end
  224.                     end
  225.                 end
  226.             end
  227.         end
  228.     end
  229. end
  230.  
  231. function OnDeleteObj(obj)
  232.     if object then
  233.         for i=1, #checkBuffForUlti, 1 do
  234.             if string.find(string.lower(object.name),checkBuffForUlti[i].spellParticle) and checkBuffForUlti[i].enabled == true then
  235.                 for i, enemy in pairs(enemyTable) do
  236.                     if GetDistance2D(enemy,object) < 30 then
  237.                         if checkBuffForUlti[i].spellType == 0 then
  238.                             enemy.canBeUlted = true
  239.                             enemy.immuneTimeout = 0
  240.                         elseif checkBuffForUlti[i].spellType == 1 then
  241.                             enemy.shield = enemy.shield - getShieldValue(checkBuffForUlti[i].spellName)
  242.                             if enemy.shield < 0 then
  243.                                 enemy.shield = 0
  244.                             end
  245.                         end
  246.                     end
  247.                 end
  248.             end
  249.         end
  250.     end
  251. end
  252.  
  253. function OnDraw()
  254.     if config.drawQrange then
  255.         for j=0,1 do
  256.             DrawCircle(player.x, player.y, player.z, qRange+j, 0xFF0000)
  257.             DrawCircle(player.x, player.y, player.z, eRange+j, 0x00FF00)
  258.         end
  259.     end
  260.     SC__OnDraw()
  261. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement