Skip to content

Instantly share code, notes, and snippets.

@zvodd
Last active August 29, 2015 14:01
Show Gist options
  • Save zvodd/8417f4bd7784165bab3c to your computer and use it in GitHub Desktop.
Save zvodd/8417f4bd7784165bab3c to your computer and use it in GitHub Desktop.
local enemies = {}
local SumSpell = "SummonerFlash"
function onLoad()
for i, heroObj in pairs(GetEnemyHeroes()) do
if heroObj and heroObj.valid then
local curflash
if hero:GetSpellData(SUMMONER_1).name:find(SumSpell) then curflash = SUMMONER_1 end
if hero:GetSpellData(SUMMONER_2).name:find(SumSpell) then curflash = SUMMONER_2 end
enemies[heroObj.charName] = {curflash, nil}
end
end
end
function OnProcessSpell(unit, spell)
if unit and unit.valid and unit.team == TEAM_ENEMY and unit.type == "obj_AI_Hero" then
if spell.name == SumSpell then
local hero = nil
-- find the rigth hero
for i=1, heroManager.iCount, 1 do
local ihero = heroManager:getHero(i)
if ihero.charName == unit.charName
hero = ihero
end
end
local cd = hero:GetSpellData(curflash).currentCd
enemies[unit.charName][2] = os.clock() + cd
print unit.charName.." cast flash"
end
end
end
function OnTick()
for k,spell_cd in pairs(enemies) do
local cd = spell_cd[2]
if cd[2] ~= nil and cd[2] < (os.clock() + 5) then
print k.." flash up in 5"
enemies[k][2] = nil
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment