Advertisement
Koelion

darius update

May 9th, 2013
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.96 KB | None | 0 0
  1. --[[
  2.  
  3. Darius Dunk v0.35 by Lux - Modified by Mwow
  4.  
  5.  
  6.  
  7. Changelog:
  8.  
  9. v0.35 Added Toggles for Ult and Q Harrass, added config menu, speed up ult usage
  10.  
  11. v0.34 different approach to avoid ultimate usage when enemy is immune
  12.  
  13. initial support to shield calculation
  14.  
  15. v0.33: added some stuff to smooth the ultimate dmg calculation
  16.  
  17. v0.32: added anivia's passive check
  18.  
  19. v0.31: added drawUltiInfo variable
  20.  
  21. v0.3: added blitzcrank's handler, various fix
  22.  
  23. v0.2: added trynda/blitz/zilean's ulti check
  24.  
  25.  
  26.  
  27. based on
  28.  
  29. Darius Ownage
  30.  
  31. v1.1
  32.  
  33. written by Weee
  34.  
  35. Modified by Delusional Logic
  36.  
  37. ]]
  38.  
  39.  
  40.  
  41.  
  42.  
  43. if GetMyHero().charName ~= "Darius" then return end
  44.  
  45.  
  46.  
  47. require "AllClass"
  48.  
  49.  
  50.  
  51. --[[ Config ]]
  52.  
  53. local drawQrange = true -- Draw the range of Q
  54.  
  55. local useExecutioner = true -- calculate Executioner or not? True / False
  56.  
  57. local havocPoints = 3 -- how many points in Havoc? 0 / 1 / 2 / 3
  58.  
  59. local drawUltiInfo = true
  60.  
  61.  
  62.  
  63. -- the R's dmg is multiplied with this value, 1.0 means nothing changes of course
  64.  
  65. local smoothMultR = 1.0
  66.  
  67. -- change to 0 if you don't want to smooth R's dmg calculation
  68.  
  69. local smoothStaticR = -2
  70.  
  71. -- -2 means that at lvl 18 the ultimate will be automatically casted on an enemy if his health is < than R's dmg-36
  72.  
  73. -- if you put this to false then the dmg removed from R will be the static number written in smoothStaticR
  74.  
  75. local smoothStaticPerLvl = true
  76.  
  77. -- 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
  78.  
  79. -- to lose in lane because the ulti isn't casted for like 12hp
  80.  
  81. local smoothDisabledBeforeLvl = 12
  82.  
  83.  
  84.  
  85. --[[ Advanced Config ]]
  86.  
  87. local targetFindRange = 80 -- This is a distance between targeted spell coordinates and your real target's coordinates.
  88.  
  89. local qBladeRange = 270
  90.  
  91. local qRange = 415
  92.  
  93. local qORange = 425
  94.  
  95. local eRange = 500 -- lowered since most of the times enemies goes out of the E range while you're casting it
  96.  
  97. local rRange = 475
  98.  
  99. local wDmgRatioPerLvl = 0.2
  100.  
  101. local rDmgRatioPerHemo = 0.2
  102.  
  103. local hemoTimeOut = 5000
  104.  
  105.  
  106.  
  107.  
  108.  
  109. --[[ Globals ]]
  110.  
  111. local enemyToAttack = nil
  112.  
  113. local enemyTable = {}
  114.  
  115. local player = GetMyHero()
  116.  
  117.  
  118.  
  119. local hemoTable = {
  120.  
  121. [1] = "darius_hemo_counter_01.troy",
  122.  
  123. [2] = "darius_hemo_counter_02.troy",
  124.  
  125. [3] = "darius_hemo_counter_03.troy",
  126.  
  127. [4] = "darius_hemo_counter_04.troy",
  128.  
  129. [5] = "darius_hemo_counter_05.troy",
  130.  
  131. }
  132.  
  133.  
  134.  
  135. local damageTable = {
  136.  
  137. Q = { base = 35, baseScale = 35, adRatio = 0.7, },
  138.  
  139. R = { base = 70, baseScale = 90, adRatio = 0.75, },
  140.  
  141. }
  142.  
  143.  
  144.  
  145. local checkBuffForUlti = {
  146.  
  147. {name="Tryndamere", spellName="undyingRage", enabled=false, spellType=0, spellLevel=1, duration=5000, spellParticle="undyingrage_glow"},
  148.  
  149. {name="Kayle", spellName="eyeForEye", enabled=false, spellType=0, spellLevel=1, duration=3000, spellParticle="eyeforaneye"},
  150.  
  151. {name="Zilean", spellName="nickOfTime", enabled=false, spellType=0, spellLevel=1, duration=7000, spellParticle="nickoftime_tar"},
  152.  
  153. {name="Nocturne", spellName="shroudOfDarkness", enabled=false, spellType=0, spellLevel=1,duration=1500,spellParticle="nocturne_shroudofdarkness_shield_cas_02"},
  154.  
  155. {name="Blitzcrank", spellName="manaBarrier", enabled=false, spellType=1, spellLevel=1, duration=10000, spellParticle="manabarrier"},
  156.  
  157. {name="Sivir", spellName="spellShield", enabled=false, spellType=0, spellLevel=1, duration=3000, spellParticle="spellblock_eff"}
  158.  
  159. }
  160.  
  161.  
  162.  
  163. for i=0, heroManager.iCount, 1 do
  164.  
  165. local playerObj = heroManager:GetHero(i)
  166.  
  167. if playerObj and playerObj.team ~= player.team then
  168.  
  169. playerObj.hemo = { tick = 0, count = 0, }
  170.  
  171. playerObj.pauseTickQ = 0
  172.  
  173. playerObj.pauseTickR = 0
  174.  
  175. playerObj.canBeUlted = true
  176.  
  177. playerObj.immuneTimeout = 0
  178.  
  179. playerObj.shield = 0
  180.  
  181. table.insert(enemyTable,playerObj)
  182.  
  183. for i=1, #checkBuffForUlti, 1 do
  184.  
  185. if checkBuffForUlti[i].name == playerObj.charName then
  186.  
  187. checkBuffForUlti[i].enabled = true
  188.  
  189. PrintChat(checkBuffForUlti[i].spellName.." check enabled")
  190.  
  191. end
  192.  
  193. end
  194.  
  195. end
  196.  
  197. end
  198.  
  199.  
  200.  
  201. --[[ Code ]]
  202.  
  203. function OnLoad()
  204.  
  205. config = scriptConfig("Darius", "Darius Dunk")
  206.  
  207. config:addParam("eActive", "Apprehend", SCRIPT_PARAM_ONKEYDOWN, false, string.byte("S"))
  208.  
  209. config:addParam("drawQrange", "Draw Ranges", SCRIPT_PARAM_ONOFF, true)
  210.  
  211. config:addParam("toggleUlt", "Toggle Auto Ultimate", SCRIPT_PARAM_ONKEYTOGGLE, true, string.byte("O"))
  212.  
  213. config:addParam("toggleQ", "Toggle Decimate harrass", SCRIPT_PARAM_ONKEYTOGGLE, true, string.byte("P"))
  214.  
  215. config:addParam("qHarrass", "Decimate Harrass", SCRIPT_PARAM_ONKEYDOWN, false, 32)
  216.  
  217. config:permaShow("toggleUlt")
  218.  
  219. config:permaShow("toggleQ")
  220.  
  221. end
  222.  
  223.  
  224.  
  225. function OnWndMsg(msg, keycode )
  226.  
  227. end
  228.  
  229.  
  230.  
  231. function ChampionInfo(champion)
  232.  
  233. local results = {}
  234.  
  235. for i=1, #checkBuffForUlti, 1 do
  236.  
  237. if checkBuffForUlti[i].name == champion or checkBuffForUlti[i].name == "*" then
  238.  
  239. table.insert(results, checkBuffForUlti[i])
  240.  
  241. end
  242.  
  243. end
  244.  
  245. return results
  246.  
  247. end
  248.  
  249.  
  250.  
  251. function CanUltiEnemy(target)
  252.  
  253. for i, enemy in pairs(enemyTable) do
  254.  
  255. if target.networkID == enemy.networkID then
  256.  
  257. if enemy.canBeUlted == false and enemy.immuneTimeout < GetTickCount() then
  258.  
  259. enemy.canBeUlted = true
  260.  
  261. enemy.immuneTimeout = 0
  262.  
  263. end
  264.  
  265. return enemy.canBeUlted
  266.  
  267. end
  268.  
  269. end
  270.  
  271. end
  272.  
  273.  
  274.  
  275. function GetShieldValue(enemy,spellName)
  276.  
  277. if spellName == "manaBarrier" then
  278.  
  279. return enemy.mana*0.5
  280.  
  281. end
  282.  
  283. end
  284.  
  285.  
  286.  
  287. function GetDuration(spellName,spellLevel)
  288.  
  289. if spellName == "undyingRage" then return 5000 end
  290.  
  291. if spellName == "eyeForEye" then return 1500+500*spellLevel end
  292.  
  293. if spellName == "nickOfTime" then return 7000 end
  294.  
  295. if spellName == "shroudOfDarkness" then return 1500 end
  296.  
  297. end
  298.  
  299.  
  300.  
  301. function OnTick()
  302.  
  303. local rDmg = (damageTable.R.base + (damageTable.R.baseScale*player:GetSpellData(_R).level) +
  304.  
  305. damageTable.R.adRatio*player.addDamage) * smoothMultR
  306.  
  307. if player.level > smoothDisabledBeforeLvl then
  308.  
  309. local rDmgInc = smoothStaticR
  310.  
  311. if smoothStaticPerLvl == true then
  312.  
  313. rDmgInc = rDmgInc * player.level
  314.  
  315. end
  316.  
  317. rDmg = rDmg + rDmgInc
  318.  
  319. end
  320.  
  321. local qDmg = damageTable.Q.base + (damageTable.Q.baseScale*player:GetSpellData(_Q).level) +
  322.  
  323. damageTable.Q.adRatio*player.addDamage
  324.  
  325. for i, enemy in pairs(enemyTable) do
  326.  
  327. local enemyHP = enemy.health + enemy.shield
  328.  
  329. if (GetTickCount() - enemy.hemo.tick > hemoTimeOut) or (enemy and enemy.dead) then enemy.hemo.count = 0 end
  330.  
  331. if enemy and not enemy.dead and enemy.visible == true and enemy.bTargetable and enemy.bInvulnerable == 0 then
  332.  
  333. local scale = 1 + havocPoints*0.005
  334.  
  335. if useExecutioner and enemyHP < enemy.maxHealth*0.4 then scale = scale + 0.06 end
  336.  
  337. qDmg = player:CalcDamage(enemy,qDmg)
  338.  
  339. if (config.qHarrass or config.toggleQ) and player:CanUseSpell(_Q) == READY and GetDistance(enemy) < qRange then CastSpell(_Q) end
  340.  
  341. if config.eActive and player:CanUseSpell(_E) == READY and GetDistance(enemy) < eRange then CastSpell(_E,enemy.x,enemy.z) end
  342.  
  343. --if GetTickCount() - enemy.pauseTickQ >= 500 and GetTickCount() - enemy.pauseTickR >= 200 then
  344.  
  345. if qDmg * scale > enemyHP and player:CanUseSpell(_Q) == READY and GetDistance(enemy) < qRange then
  346.  
  347. CastSpell(_Q)
  348.  
  349. --enemy.pauseTickQ = GetTickCount()
  350.  
  351. elseif ( qDmg * 1.5 ) * scale > enemyHP and player:CanUseSpell(_Q) == READY and GetDistance(enemy) < qRange and GetDistance(enemy) >= qBladeRange then
  352.  
  353. CastSpell(_Q)
  354.  
  355. --enemy.pauseTickQ = GetTickCount()
  356.  
  357. 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
  358.  
  359. CastSpell(_R,enemy)
  360.  
  361. --enemy.pauseTickR = GetTickCount()
  362.  
  363. end
  364.  
  365.  
  366.  
  367. if player:GetSpellData(_R).level > 0 and player:GetDistance(enemy) < 3500 and drawUltiInfo == true then
  368.  
  369. if qDmg + rDmg * ( 1.0 + rDmgRatioPerHemo * enemy.hemo.count ) > enemyHP then
  370. PrintFloatText(enemy,0,"Killable")
  371. elseif CanUltiEnemy(enemy) == false then
  372.  
  373. PrintFloatText(enemy,0,"IMMUNE")
  374.  
  375. elseif rDmg * ( 1.0 + rDmgRatioPerHemo * enemy.hemo.count ) > enemyHP then
  376.  
  377. PrintFloatText(enemy,0,"DUNK")
  378.  
  379. else
  380.  
  381. PrintFloatText(enemy,0,"" .. math.ceil(enemyHP - (rDmg * ( 1.0 + rDmgRatioPerHemo * enemy.hemo.count ))) .. " hp" .. " - " .. enemy.hemo.count)
  382.  
  383. end
  384.  
  385. end
  386.  
  387. --end
  388.  
  389. end
  390.  
  391. end
  392.  
  393. end
  394.  
  395.  
  396.  
  397. function OnCreateObj( object )
  398.  
  399. if object then
  400.  
  401. for i=1, #checkBuffForUlti, 1 do
  402.  
  403. if string.find(string.lower(object.name),checkBuffForUlti[i].spellParticle) and checkBuffForUlti[i].enabled == true then
  404.  
  405. for i, enemy in pairs(enemyTable) do
  406.  
  407. if GetDistance2D(enemy,object) < 30 then
  408.  
  409. if checkBuffForUlti[i].spellType == 0 then
  410.  
  411. enemy.canBeUlted = false
  412.  
  413. enemy.immuneTimeout = GetTickCount()+checkBuffForUlti[i].duration
  414.  
  415. elseif checkBuffForUlti[i].spellType == 1 then
  416.  
  417. enemy.shield = enemy.shield + getShieldValue(checkBuffForUlti[i].spellName)
  418.  
  419. end
  420.  
  421. end
  422.  
  423. end
  424.  
  425. end
  426.  
  427. end
  428.  
  429.  
  430.  
  431. if string.find(string.lower(object.name),"darius_hemo_counter") then
  432.  
  433. for i, enemy in pairs(enemyTable) do
  434.  
  435. if enemy and not enemy.dead and enemy.visible and GetDistance2D(enemy,object) <= targetFindRange then
  436.  
  437. for k, hemo in pairs(hemoTable) do
  438.  
  439. if object.name == hemo then
  440.  
  441. enemy.hemo.tick = GetTickCount()
  442.  
  443. enemy.hemo.count = k
  444.  
  445. PrintFloatText(enemy,21,k .. " Bleedings")
  446.  
  447. end
  448.  
  449. end
  450.  
  451. end
  452.  
  453. end
  454.  
  455. end
  456.  
  457. end
  458.  
  459. end
  460.  
  461.  
  462.  
  463. function OnDeleteObj(obj)
  464.  
  465. if object then
  466.  
  467. for i=1, #checkBuffForUlti, 1 do
  468.  
  469. if string.find(string.lower(object.name),checkBuffForUlti[i].spellParticle) and checkBuffForUlti[i].enabled == true then
  470.  
  471. for i, enemy in pairs(enemyTable) do
  472.  
  473. if GetDistance2D(enemy,object) < 30 then
  474.  
  475. if checkBuffForUlti[i].spellType == 0 then
  476.  
  477. enemy.canBeUlted = true
  478.  
  479. enemy.immuneTimeout = 0
  480.  
  481. elseif checkBuffForUlti[i].spellType == 1 then
  482.  
  483. enemy.shield = enemy.shield - getShieldValue(checkBuffForUlti[i].spellName)
  484.  
  485. if enemy.shield < 0 then
  486.  
  487. enemy.shield = 0
  488.  
  489. end
  490.  
  491. end
  492.  
  493. end
  494.  
  495. end
  496.  
  497. end
  498.  
  499. end
  500.  
  501. end
  502.  
  503. end
  504.  
  505.  
  506.  
  507. function OnDraw()
  508.  
  509.  
  510. if config.drawQrange and not myHero.dead then
  511.  
  512. for j=0,1 do
  513.  
  514. DrawCircle(player.x, player.y, player.z, qORange+j, 0xFF0000)
  515. DrawCircle(player.x, player.y, player.z, qBladeRange+j, 0xFF0000)
  516. DrawCircle(player.x, player.y, player.z, eRange+j, 0x66FFFF)
  517.  
  518. end
  519.  
  520. end
  521.  
  522. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement