Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if player == nil then player = GetMyHero() end
- if player.charName ~= "Twitch" then return end
- eRange = 1200
- poisonTimeOut = 6000
- enemyTable = {}
- poisonTable =
- {
- [1] = "Data\\Particles\\twitch_poison_counter_01.troy",
- [2] = "Data\\Particles\\twitch_poison_counter_02.troy",
- [3] = "Data\\Particles\\twitch_poison_counter_03.troy",
- [4] = "Data\\Particles\\twitch_poison_counter_04.troy",
- [5] = "Data\\Particles\\twitch_poison_counter_05.troy",
- [6] = "Data\\Particles\\twitch_poison_counter_06.troy",
- }
- function GetDistance2D(o1, o2)
- local c = "z"
- if o1.z == nil or o2.z == nil then c = "y" end
- return math.sqrt(math.pow(o1.x - o2.x, 2) + math.pow(o1[c] - o2[c], 2))
- end
- function tickhandler()
- local tick = GetTickCount()
- local baseEDmg = 20 + (player:GetSpellData(_E).level-1)*15
- for i, enemy in pairs(enemyTable) do
- if enemy.poison.count > 0 and ( (tick - enemy.poison.tick > poisonTimeOut) or enemy.dead) then
- enemy.poison.count = 0
- end
- if enemy and not enemy.dead and enemy.visible and enemy.bTargetable and enemy.bInvulnerable == 0 then
- 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)
- if player:CanUseSpell(_E) == READY and GetDistance2D(player, enemy) < eRange and (player:CalcDamage(enemy, eDmg) > enemy.health or enemy.poison.count == 6) then
- -- PrintChat("Deal " .. "[Raw: ".. eDmg .."] " .. math.floor(player:CalcDamage(enemy, eDmg)) .. "/" .. math.floor(enemy.health) .. " to " .. enemy.charName .. "[".. enemy.poison.count .."]")
- CastSpell(_E)
- end
- end
- end
- end
- local function objectHandler(object)
- if object and object.name:lower():find("twitch_poison_counter") then
- for i, enemy in pairs(enemyTable) do
- if enemy and not enemy.dead and enemy.visible and GetDistance2D(enemy,object) <= 80 then
- for k, poison in pairs(poisonTable) do
- if object.name == poison then
- enemy.poison.tick = GetTickCount()
- enemy.poison.count = k
- -- PrintChat(">>" .. enemy.charName .. "[".. enemy.poison.count .."]")
- end
- end
- end
- end
- end
- end
- for i=1, heroManager.iCount do
- local playerObj = heroManager:GetHero(i)
- if playerObj and playerObj.team ~= player.team then
- playerObj.poison = { tick = 0, count = 0 }
- enemyTable[playerObj.networkID] = playerObj
- end
- end
- BoL:addCreateObjHandler(objectHandler)
- BoL:addTickHandler(tickhandler, 50)
- PrintChat(" >> Twitch Auto Expunge loaded!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement