Advertisement
mwow

Untitled

Aug 24th, 2012
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.76 KB | None | 0 0
  1. if player == nil then player = GetMyHero() end
  2. if player.charName ~= "Twitch" then return end
  3.  
  4. eRange          = 1200
  5. poisonTimeOut   = 6000
  6. enemyTable      = {}
  7.  
  8. poisonTable =
  9. {
  10.         [1] = "Data\\Particles\\twitch_poison_counter_01.troy",
  11.         [2] = "Data\\Particles\\twitch_poison_counter_02.troy",
  12.         [3] = "Data\\Particles\\twitch_poison_counter_03.troy",
  13.         [4] = "Data\\Particles\\twitch_poison_counter_04.troy",
  14.         [5] = "Data\\Particles\\twitch_poison_counter_05.troy",
  15.         [6] = "Data\\Particles\\twitch_poison_counter_06.troy",
  16. }
  17.  
  18. function GetDistance2D(o1, o2)    
  19.     local c = "z"
  20.     if o1.z == nil or o2.z == nil then c = "y" end
  21.     return math.sqrt(math.pow(o1.x - o2.x, 2) + math.pow(o1[c] - o2[c], 2))
  22. end
  23.  
  24. function tickhandler()
  25.     local tick = GetTickCount()
  26.  
  27.     local baseEDmg = 20 + (player:GetSpellData(_E).level-1)*15
  28.     for i, enemy in pairs(enemyTable) do
  29.        
  30.         if enemy.poison.count > 0 and ( (tick - enemy.poison.tick > poisonTimeOut) or enemy.dead) then
  31.            
  32.             enemy.poison.count = 0
  33.         end
  34.  
  35.         if enemy and not enemy.dead and enemy.visible and enemy.bTargetable and enemy.bInvulnerable == 0 then
  36.             local eDmg = baseEDmg +  (enemy.poison.count * (15 + (player:GetSpellData(_E).level-1)*5)) + (enemy.poison.count * 0.25 * player.ap) + (enemy.poison.count * 0.25 * player.addDamage)
  37.            
  38.             if  player:CanUseSpell(_E) == READY and GetDistance2D(player, enemy) < eRange and (player:CalcDamage(enemy, eDmg) > enemy.health or enemy.poison.count == 6) then
  39.                 -- PrintChat("Deal " .. "[Raw: ".. eDmg .."] " ..  math.floor(player:CalcDamage(enemy, eDmg)) .. "/" .. math.floor(enemy.health) .. " to " .. enemy.charName .. "[".. enemy.poison.count .."]")
  40.                 CastSpell(_E)
  41.             end
  42.         end
  43.     end
  44. end
  45.  
  46.  
  47. local function objectHandler(object)
  48.     if object and object.name:lower():find("twitch_poison_counter") then
  49.         for i, enemy in pairs(enemyTable) do
  50.             if enemy and not enemy.dead and enemy.visible and GetDistance2D(enemy,object) <= 80 then
  51.                 for k, poison in pairs(poisonTable) do
  52.                     if object.name == poison then
  53.                         enemy.poison.tick = GetTickCount()
  54.                         enemy.poison.count = k
  55.                         -- PrintChat(">>" .. enemy.charName .. "[".. enemy.poison.count .."]")
  56.                     end
  57.                 end
  58.             end
  59.         end
  60.     end
  61. end
  62.  
  63.  
  64.  
  65. for i=1, heroManager.iCount do
  66.     local playerObj = heroManager:GetHero(i)
  67.     if playerObj and playerObj.team ~= player.team then
  68.         playerObj.poison = { tick = 0, count = 0 }
  69.         enemyTable[playerObj.networkID] = playerObj
  70.     end
  71. end
  72.  
  73.  
  74. BoL:addCreateObjHandler(objectHandler)
  75. BoL:addTickHandler(tickhandler, 50)
  76.  
  77. PrintChat(" >> Twitch Auto Expunge loaded!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement