Advertisement
Guest User

Kalista.lua

a guest
May 27th, 2015
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. if myHero.charName ~= "Kalista" then return end
  2.  
  3. if VIP_USER then
  4.     require "VPrediction"
  5.   require "HPrediction"
  6.     PrintChat("DaKaliGod using Vprediction - ")
  7. else
  8.     PrintChat("DaKaliGod using HPrediction!")
  9. end
  10.  
  11. local enemyHeroes = {}
  12. local spellE = myHero:GetSpellData(_E)
  13. local VP = nil
  14. local TP = nil
  15.  
  16. UpdateWindow()
  17. tSize = math.floor(WINDOW_H/35 + 0.5)
  18. local x = math.floor(WINDOW_W * 0.2 + 0.5)
  19. local y = math.floor(WINDOW_H * 0.015 + 0.5)
  20. local debugMSG = ""
  21. local ts = nil
  22. local tsE = nil
  23. local SpellRangedQ = {Range = 1150, Speed = 1200, Delay = 0.4, Width = 30}
  24.  
  25. local monsters = {
  26.     {   -- baron
  27.         name = "baron",
  28.         spawn = 900,
  29.         respawn = 420,
  30.         advise = true,
  31.         camps = {
  32.             {
  33.                 pos = { x = 4960, y = 60, z = 10420 },
  34.                 name = "monsterCamp_12",
  35.                 creeps = { { { name = "SRU_Baron12.1.1" }, }, },
  36.                 team = TEAM_NEUTRAL,
  37.             },
  38.         },
  39.     },
  40.     {   -- dragon
  41.         name = "dragon",
  42.         spawn = 150,
  43.         respawn = 360,
  44.         advise = true,
  45.         camps = {
  46.             {
  47.                 pos = { x = 9846, y = 60, z = 4449 },
  48.                 name = "monsterCamp_6",
  49.                 creeps = { { { name = "SRU_Dragon6.1.1" }, }, },
  50.                 team = TEAM_NEUTRAL,
  51.             },
  52.         },
  53.     },
  54.     {   -- red
  55.         name = "red",
  56.         spawn = 115,
  57.         respawn = 300,
  58.         advise = true,
  59.         camps = {
  60.             {
  61.                 pos = { x = 7832, y = 60, z = 4173 },
  62.                 name = "monsterCamp_4",
  63.                 creeps = { { { name = "SRU_Red4.1.1" }, }, },
  64.                 team = TEAM_BLUE,
  65.             },
  66.             {
  67.                 pos = { x = 7031, y = 60, z = 10875 },
  68.                 name = "monsterCamp_10",
  69.                 creeps = { { { name = "SRU_Red10.1.1" }, }, },
  70.                 team = TEAM_RED,
  71.             },
  72.         },
  73.     },
  74.     {   -- blue
  75.         name = "blue",
  76.         spawn = 115,
  77.         respawn = 300,
  78.         advise = true,
  79.         camps = {
  80.             {
  81.                 pos = { x = 3873, y = 60, z = 8007 },
  82.                 name = "monsterCamp_1",
  83.                 creeps = { { { name = "SRU_Blue1.1.1" }, }, },
  84.                 team = TEAM_BLUE,
  85.             },
  86.             {
  87.                 pos = { x = 10935, y = 60, z = 7017 },
  88.                 name = "monsterCamp_7",
  89.                 creeps = { { { name = "SRU_Blue7.1.1" }, }, },
  90.                 team = TEAM_RED,
  91.             },
  92.         },
  93.     },
  94. }
  95.  
  96. function firstToUpper(str)
  97.     return (str:gsub("^%l", string.upper))
  98. end
  99.  
  100. function Menu()
  101.     ts = TargetSelector(TARGET_LESS_CAST_PRIORITY, SpellRangedQ.Range, DAMAGE_PHYSICAL)
  102.     ts.name = "Ranged Main"
  103.     tsE = TargetSelector(TARGET_LESS_CAST_PRIORITY, 1000, DAMAGE_PHYSICAL)
  104.     tsE.name = "E Target"
  105.     Config = scriptConfig("Kalista", "Kalista")
  106.     Config:addTS(ts)
  107.     Config:addTS(tsE)
  108.     Config:addParam("Combo", "Combo", SCRIPT_PARAM_ONKEYDOWN, false, 32)
  109.     Config:addParam("Harass", "Harass", SCRIPT_PARAM_ONKEYDOWN, false, string.byte('C'))
  110.     --Config:addParam("ks", "KS with E", SCRIPT_PARAM_ONOFF, true)
  111.     Config:addSubMenu("Combo options", "ComboSub")
  112.     Config:addSubMenu("Harass options", "HarassSub")
  113.     Config:addSubMenu("KS options", "KSSub")
  114.     Config:addSubMenu("Draw", "Draw")
  115.     Config:addSubMenu("Extra", "Extra")
  116.     Config.ComboSub:addParam("useQ", "Use Q", SCRIPT_PARAM_ONOFF, true)
  117.     Config.ComboSub:addParam("autoERange", "Auto E on max range", SCRIPT_PARAM_ONOFF, true)
  118.     Config.ComboSub:addParam("autoE", "Auto E on stacks reached", SCRIPT_PARAM_ONOFF, false)
  119.     Config.ComboSub:addParam("autoEStacks", "Number of stacks reached: ", SCRIPT_PARAM_SLICE, 10, 1, 15, 0)
  120.     Config.HarassSub:addParam("useQ", "Use Q", SCRIPT_PARAM_ONOFF, true)
  121.     Config.HarassSub:addParam("autoERange", "Auto E on max range", SCRIPT_PARAM_ONOFF, true)
  122.     Config.HarassSub:addParam("autoE", "Auto E on stacks reached", SCRIPT_PARAM_ONOFF, true)
  123.     Config.HarassSub:addParam("autoEStacks", "Number of stacks reached: ", SCRIPT_PARAM_SLICE, 10, 1, 15, 0)
  124.     Config.KSSub:addParam("ks", "Champion KS with E", SCRIPT_PARAM_ONOFF, true)
  125.     Config.KSSub:addParam("jungle", "Secure jungle with E", SCRIPT_PARAM_ONOFF, true)
  126.     Config.KSSub:addSubMenu("Jungle Creeps to Steal", "creepList")
  127.     for i,monster in pairs(monsters) do
  128.         Config.KSSub.creepList:addParam(monster.name,firstToUpper(monster.name),SCRIPT_PARAM_ONOFF, true)
  129.     end
  130.     -- Config.KSSub.creepList:addParam("baron","Baron", SCRIPT_PARAM_ONOFF, true)
  131.     -- Config.KSSub.creepList:addParam("dragon","Dragon", SCRIPT_PARAM_ONOFF, true)
  132.     -- Config.KSSub.creepList:addParam("red","Red", SCRIPT_PARAM_ONOFF, true)
  133.     -- Config.KSSub.creepList:addParam("blue","Blue", SCRIPT_PARAM_ONOFF, true)
  134.     Config.Draw:addParam("drawQ", "Draw Q Range", SCRIPT_PARAM_ONOFF, false)
  135.     Config.Draw:addParam("drawE", "Draw E Range", SCRIPT_PARAM_ONOFF, true)
  136.     Config.Extra:addParam("debug", "Debug Mode", SCRIPT_PARAM_ONOFF, false)
  137.     Config.Extra:addParam("packetCast", "Packet Cast Spells", SCRIPT_PARAM_ONOFF, true)
  138.  
  139. end
  140.  
  141. function OnLoad()
  142.     Menu() --initialize Config Menu
  143.     if VIP_USER then
  144.         --PrintChat("Using Vprediction")
  145.         VP = VPrediction()
  146.     end
  147.     TP = TargetPrediction(1150, 1200, 0.46, 30, 100)
  148.  
  149.  
  150.     for i = 1, heroManager.iCount do --enemy table for keeping track of stacks of rend
  151.         local hero = heroManager:GetHero(i)
  152.         if hero.team ~= myHero.team then
  153.             table.insert(enemyHeroes, { object =hero, stack = 0, time = 0})
  154.         end
  155.     end
  156.  
  157.     for i = 1, objManager.maxObjects do --if jungle creep is in objectmanage, lets "process" it with addcampcreep function
  158.         local object = objManager:getObject(i)
  159.         if object ~= nil then
  160.             addCampCreepAltar(object)
  161.         end
  162.     end
  163.  
  164.     -- for i,monster in pairs(monsters) do
  165.     --  monster.advise = true
  166.     -- end
  167.  
  168.     AddCreateObjCallback(addCampCreepAltar)  --make sure items that are created or destroyed are processed properly
  169.     AddDeleteObjCallback(removeCreep)
  170.  
  171. end
  172.  
  173. function addCampCreepAltar(object)
  174.     if object ~= nil and object.name ~= nil then
  175.         for i,monster in pairs(monsters) do
  176.             for j,camp in pairs(monster.camps) do
  177.                 if camp.name == object.name then
  178.                     --PrintChat(object.name) --setting monsterCamp
  179.                     camp.object = object
  180.                     return
  181.                 end
  182.                 if object.type == "obj_AI_Minion" then  --do this most of the time for SR I guess
  183.                     for k,creepPack in ipairs(camp.creeps) do
  184.                         for l,creep in ipairs(creepPack) do
  185.                             if object.name == creep.name or object.name:find(creep.name) then
  186.                                 creep.object = object  --set the creep list object to actual object in game
  187.                                 creep.stack = 0
  188.                                 creep.time = 0
  189.                                 return
  190.                             end
  191.                         end
  192.                     end
  193.                 end
  194.             end
  195.         end
  196.     end
  197. end
  198.  
  199. function removeCreep(object)
  200.     if object ~= nil and object.type == "obj_AI_Minion" and object.name ~= nil then
  201.         for i,monster in pairs(monsters) do --name == baron level
  202.             for j,camp in pairs(monster.camps) do -- monster_camp# level
  203.                 for k,creepPack in ipairs(camp.creeps) do --group of creeps
  204.                     for l,creep in ipairs(creepPack) do --individual creep
  205.                         if object.name == creep.name or object.name:find(creep.name) then
  206.                             creep.object = nil --set jungle list object to nil
  207.                             return
  208.                         end
  209.                     end
  210.                 end
  211.             end
  212.         end
  213.     end
  214. end
  215.  
  216. local lastTick = 0
  217.  
  218. function OnTick()
  219.     ts:update()
  220.     tsE:update()
  221.     local Elvl = myHero:GetSpellData(_E).level
  222.  
  223.     if GetTickCount() > lastTick or 1 then
  224.         debugMSG = debugMSG .. '\n'
  225.         for i= 1, #monsters do
  226.             local monster = monsters[i]
  227.             monster.advise = Config.KSSub.creepList[monster.name]
  228.             -- if monster.advise then
  229.             --  PrintChat(monster.name .. " is true!")
  230.             -- end
  231.             -- if Config.Extra.debug then
  232.             --  debugMSG = debugMSG .. monster.name .. ': ' .. tostring(monster.advise)
  233.             -- end
  234.         end
  235.         -- debugMSG = debugMSG .. '\n'
  236.         lastTick = GetTickCount() + 2000
  237.     end
  238.  
  239.  
  240.     debugMSG = "debug: "
  241.     for i, target in pairs(enemyHeroes) do --clear timedout stacks
  242.         if Config.Extra.debug then
  243.             debugMSG = debugMSG .. target.object.charName .. ": " .. tostring(target.stack) ..'    ' .. tostring(GetGameTimer() - target.time) .. '\n'
  244.         end
  245.  
  246.         if target.stack > 0 and (GetGameTimer() - target.time) > 4 then
  247.             target.stack = 0
  248.         end
  249.     end
  250.  
  251.     if Config.KSSub.ks then
  252.         for i, target in pairs(enemyHeroes) do
  253.             if ValidTarget(target.object, 1000) and target.stack > 0 then
  254.                 -- local dmg = getDmg("E", target.object, myHero, 3)
  255.                 -- dmg = dmg * (1.25 + (Elvl -1)* 0.05)^(target.stack-1)
  256.                 -- dmg = dmg * 0.90
  257.                 local dmg = eDmgCalc(target.object,target.stack)
  258.                 if Config.Extra.debug then
  259.                     debugMSG = debugMSG .. "First dmg: " .. tostring(getDmg("E", target.object, myHero, 1)) .. " Second dmg: " .. tostring(getDmg("E", target.object, myHero, 2)*target.stack)
  260.                     .. " Third dmg: " .. tostring(getDmg("E", target.object, myHero, 3)) .. "\nE lvl: " .. tostring(Elvl)
  261.                 end
  262.                 if target.stack > 0 then
  263.                     if target.object.health <= dmg then
  264.                         if Config.Extra.packetCast and VIP_USER then
  265.                             packetCast(_E)
  266.                         else
  267.                             CastSpell(_E)
  268.                         end
  269.                     end
  270.                 end
  271.             end
  272.         end
  273.     end
  274.  
  275.     if Config.KSSub.jungle then
  276.         for i,monster in pairs(monsters) do --name = baron level
  277.             for j,camp in pairs(monster.camps) do
  278.                 for k,creepPack in ipairs(camp.creeps) do
  279.                     for l,creep in ipairs(creepPack) do
  280.                         if creep.object ~= nil and creep.object.valid and creep.object.dead == false and creep.stack > 0 and monster.advise then
  281.                             local dmg = eDmgCalc(creep.object,creep.stack)
  282.                             if dmg >= creep.object.health then
  283.                                 if Config.Extra.packetCast and VIP_USER then
  284.                                     packetCast(_E)
  285.                                 else
  286.                                     CastSpell(_E)
  287.                                 end
  288.                             end
  289.                         end
  290.                     end
  291.                 end
  292.             end
  293.         end
  294.     end
  295.  
  296.     if Config.Combo then
  297.         Combo()
  298.     end
  299.     if Config.Harass then
  300.         Harass()
  301.     end
  302. end
  303.  
  304. function eDmgCalc(unit, stacks)
  305.     local first = {
  306.         dmg = {20, 30, 40, 50, 60},
  307.         scaling = .60
  308.     }
  309.     local adds = {
  310.         dmg = {5, 9, 14, 20, 27},
  311.         scaling = {.15, .18, .21, .24, .27}
  312.     }
  313.     if unit and stacks > 0 then
  314.         local mainDmg  = first.dmg[myHero:GetSpellData(_E).level] + (first.scaling * myHero.totalDamage)
  315.         local extraDmg = (stacks > 1 and (adds.dmg[myHero:GetSpellData(_E).level] + (adds.scaling[myHero:GetSpellData(_E).level] * myHero.totalDamage)) * (stacks - 1)) or 0
  316.         return myHero:CalcDamage(unit, (mainDmg + extraDmg))
  317.     end
  318. end
  319.  
  320. function Combo()
  321.     local target = ts.target
  322.     if target ~= nil and ValidTarget(target,1200) and myHero:CanUseSpell(_Q) == READY and Config.ComboSub.useQ then
  323.         if not VIP_USER then
  324.             local nextPos, minionCol, nextHealth = TP:GetPrediction(target)
  325.             if nextPos ~= nil and not minionCol then
  326.                 CastSpell(_Q,nextPos.x, nextPos.z)
  327.             end
  328.         else
  329.             local castPos, HitChance, Position = VP:GetLineCastPosition(target, 0.46, 30, 1150, 1200, myHero, true)
  330.             if castPos ~= nil and GetDistance(castPos)<SpellRangedQ.Range and HitChance > 0 then
  331.                 --PrintChat("castPos x: " .. tostring(castPos.x) .. " castPos z: " .. tostring(castPos.z))
  332.                 if Config.Extra.packetCast and VIP_USER then
  333.                     packetCast(_Q, castPos.x, castPos.z)
  334.                 else
  335.                     CastSpell(_Q, castPos.x, castPos.z)
  336.                 end
  337.             end
  338.         end
  339.     end
  340.  
  341.     for i, current in pairs(enemyHeroes) do
  342.         local targets = tsE.target
  343.  
  344.         if targets ~= nil and targets == current.object then
  345.             local Position, HitChance, myPosition, myHitChance = nil
  346.             local Position, minionCol, nextHealth, myPosition, minionCol, nextHealth   = nil
  347.             if Config.ComboSub.autoERange and myHero:CanUseSpell(_E) == READY and ValidTarget(current.object,1000) and current.stack > 1 then
  348.                 if VIP_USER then
  349.                     Position, HitChance = VP:GetPredictedPos(current.object, 0.5)
  350.                 --PrintChat("Position Predicted: " .. tostring(Position.x) .. ", " .. tostring(Position.z))
  351.                     myPosition, myHitChance = VP:GetPredictedPos(myHero,0.5)
  352.                 else
  353.                     Position, minionCol, nextHealth = TP:GetPrediction(target)
  354.                     myPosition, minionCol, nextHealth = TP:GetPrediction(myHero)
  355.                 end
  356.                 if Config.Extra.debug then
  357.                     debugMSG = debugMSG .. "\nPredicted Distance: " .. tostring(GetDistance(Position,myPosition)) .. "\n"
  358.                     --PrintChat("Predicted distance: " .. GetDistance(Position,myPosition))
  359.                 end
  360.                 if GetDistance(Position,myPosition) >= 1000 then
  361.                     if Config.Extra.debug then
  362.                         PrintChat("Leaving range!")
  363.                     end
  364.                     if Config.Extra.packetCast and VIP_USER then
  365.                         packetCast(_E)
  366.                     else
  367.                         CastSpell(_E)
  368.                     end
  369.                 end
  370.             end
  371.         end
  372.     end
  373.            
  374.  
  375.     for i, current in pairs(enemyHeroes) do
  376.         if target ~= nil and current.object.name == target.name then
  377.             --PrintChat("Object matches target")
  378.             if Config.ComboSub.autoE and myHero:CanUseSpell(_E) == READY and current.stack >= Config.ComboSub.autoEStacks then
  379.                 if Config.Extra.packetCast and VIP_USER then
  380.                     packetCast(_E)
  381.                 else
  382.                     CastSpell(_E)
  383.                 end
  384.             end
  385.  
  386.             -- if Config.ComboSub.autoERange and myHero:CanUseSpell(_E) == READY and ValidTarget(current.object,1000) and current.stack > 1 then
  387.             --  local Position, HitChance = VP:GetPredictedPos(current.object, 0.5)
  388.             --  --PrintChat("Position Predicted: " .. tostring(Position.x) .. ", " .. tostring(Position.z))
  389.             --  local myPosition, myHitChance = VP:GetPredictedPos(myHero,0.5)
  390.             --  if Config.Extra.debug then
  391.             --      debugMSG = debugMSG .. "\nPredicted Distance: " .. tostring(GetDistance(Position,myPosition)) .. "\n"
  392.             --      --PrintChat("Predicted distance: " .. GetDistance(Position,myPosition))
  393.             --  end
  394.             --  if GetDistance(Position,myPosition) >= 1000 then
  395.             --      if Config.Extra.debug then
  396.             --          PrintChat("Leaving range!")
  397.             --      end
  398.             --      if Config.Extra.packetCast and VIP_USER then
  399.             --          packetCast(_E)
  400.             --      else
  401.             --          CastSpell(_E)
  402.             --      end
  403.             --  end
  404.             -- end
  405.         end
  406.     end
  407. end
  408.  
  409. function Harass()
  410.     local target = ts.target
  411.     if target ~= nil and ValidTarget(target,1500) and myHero:CanUseSpell(_Q) == READY and Config.HarassSub.useQ then
  412.         if not VIP_USER then
  413.             local nextPos, minionCol, nextHealth = TP:GetPrediction(target)
  414.             if nextPos ~= nil and not minionCol then
  415.                 CastSpell(_Q,nextPos.x, nextPos.z)
  416.             end
  417.         else
  418.             local castPos, HitChance, Position = VP:GetLineCastPosition(target, 0.46, 30, 1150, 1200, myHero, true)
  419.             if castPos ~= nil and GetDistance(castPos)<SpellRangedQ.Range and HitChance > 0 then
  420.                 --PrintChat("castPos x: " .. tostring(castPos.x) .. " castPos z: " .. tostring(castPos.z))
  421.                 if Config.Extra.packetCast and VIP_USER then
  422.                     packetCast(_Q, castPos.x, castPos.z)
  423.                 else
  424.                     CastSpell(_Q, castPos.x, castPos.z)
  425.                 end
  426.             end
  427.         end
  428.     end
  429.  
  430.     for i, current in pairs(enemyHeroes) do
  431.         local targets = tsE.target
  432.  
  433.         if targets ~= nil and targets == current.object then
  434.             local Position, HitChance, myPosition, myHitChance = nil
  435.             local Position, minionCol, nextHealth, myPosition, minionCol, nextHealth   = nil
  436.  
  437.             if Config.HarassSub.autoERange and myHero:CanUseSpell(_E) == READY and ValidTarget(current.object,1000) and current.stack > 1 then
  438.                 if VIP_USER then
  439.                     Position, HitChance = VP:GetPredictedPos(current.object, 0.5)
  440.                 --PrintChat("Position Predicted: " .. tostring(Position.x) .. ", " .. tostring(Position.z))
  441.                     myPosition, myHitChance = VP:GetPredictedPos(myHero,0.5)
  442.                 else
  443.                     Position, minionCol, nextHealth = TP:GetPrediction(target)
  444.                     myPosition, minionCol, nextHealth = TP:GetPrediction(myHero)
  445.                 end
  446.                 if Config.Extra.debug then
  447.                     debugMSG = debugMSG .. "\nPredicted Distance: " .. tostring(GetDistance(Position,myPosition)) .. "\n"
  448.                     --PrintChat("Predicted distance: " .. GetDistance(Position,myPosition))
  449.                 end
  450.                 if GetDistance(Position,myPosition) >= 1000 then
  451.                     if Config.Extra.debug then
  452.                         PrintChat("Leaving range!")
  453.                     end
  454.                     if Config.Extra.packetCast and VIP_USER then
  455.                         packetCast(_E)
  456.                     else
  457.                         CastSpell(_E)
  458.                     end
  459.                 end
  460.             end
  461.         end
  462.     end
  463.  
  464.  
  465.     for i, current in pairs(enemyHeroes) do
  466.  
  467.         if target ~= nil and current.object.name == target.name then
  468.             --PrintChat("Object matches target")
  469.             if Config.HarassSub.autoE and myHero:CanUseSpell(_E) == READY and current.stack >= Config.HarassSub.autoEStacks then
  470.                 if Config.Extra.packetCast and VIP_USER then
  471.                     packetCast(_E)
  472.                 else
  473.                     CastSpell(_E)
  474.                 end
  475.             end
  476.  
  477.             -- if Config.HarassSub.autoERange and myHero:CanUseSpell(_E) == READY and ValidTarget(current.object,1000) and current.stack > 1 then
  478.             --  local Position, HitChance = VP:GetPredictedPos(current.object, 0.5)
  479.             --  --PrintChat("Position Predicted: " .. tostring(Position.x) .. ", " .. tostring(Position.z))
  480.             --  local myPosition, myHitChance = VP:GetPredictedPos(myHero,0.5)
  481.             --  if Config.Extra.debug then
  482.             --      debugMSG = debugMSG .. "\nPredicted Distance: " .. tostring(GetDistance(Position,myPosition)) .. "\n"
  483.             --      --PrintChat("Predicted distance: " .. GetDistance(Position,myPosition))
  484.             --  end
  485.             --  if GetDistance(Position,myPosition) >= 1000 then
  486.             --      if Config.Extra.debug then
  487.             --          PrintChat("Leaving range!")
  488.             --      end
  489.             --      if Config.Extra.packetCast and VIP_USER then
  490.             --          packetCast(_E)
  491.             --      else
  492.             --          CastSpell(_E)
  493.             --      end
  494.             --  end
  495.             -- end
  496.         end
  497.     end
  498.  
  499. end
  500.  
  501. function OnDraw()
  502.     if Config.Extra.debug then
  503.         DrawText(debugMSG,tSize,x,y,0xFFFF0000)
  504.     end
  505.  
  506.     if Config.Draw.drawE and myHero:CanUseSpell(_E) == READY then
  507.         DrawCircle(myHero.x, myHero.y, myHero.z, 1000, ARGB(200,17,17,17))
  508.     end
  509.  
  510.     if Config.Draw.drawQ and myHero:CanUseSpell(_Q) == READY then
  511.         DrawCircle3D(myHero.x, myHero.y, myHero.z, 1150, 1, ARGB(100,0,255,0),100)
  512.     end
  513.  
  514. end
  515.  
  516. function OnGainBuff(unit, buff)
  517.     if buff.source == myHero and buff.name == 'kalistaexpungemarker' then
  518.         for i, target in ipairs(enemyHeroes) do
  519.             if target.object == unit then
  520.                 target.stack = 1
  521.                 target.time = GetGameTimer()
  522.             end
  523.         end
  524.     end
  525. end
  526.  
  527. function OnUpdateBuff(unit, buff)
  528.     if buff.source == myHero and buff.name == 'kalistaexpungemarker' then
  529.         for i, target in ipairs(enemyHeroes) do
  530.             if target.object == unit then
  531.                 target.stack = target.stack + 1
  532.                 target.time = GetGameTimer()
  533.             end
  534.         end
  535.     end
  536. end
  537.  
  538. function OnLoseBuff(unit, buff)
  539.     if buff.name == 'kalistaexpungemarker' then
  540.         for i, target in ipairs(enemyHeroes) do
  541.             if target.object == unit then
  542.                 target.stack = 0
  543.             end
  544.         end
  545.     end
  546. end
  547.  
  548. function OnCreateObj(obj)
  549.     -- for i, target in pairs(enemyHeroes) do
  550.  
  551.  --         if GetDistance(target.object, obj) <80 then
  552.  --             if obj.name == "Kalista_Base_E_Spear_tar6.troy" then
  553.  --                 if target.stack < 6 then
  554.  --                     target.stack = 6
  555.  --                 end
  556.  --                 target.time = GetGameTimer()
  557.  
  558.     --      elseif obj.name == "Kalista_Base_E_Spear_tar5.troy" then
  559.     --          if target.stack < 6 then
  560.  --                     target.stack = 5
  561.  --                 end
  562.     --          target.time = GetGameTimer()
  563.     --      elseif obj.name == "Kalista_Base_E_Spear_tar4.troy" then
  564.     --          if target.stack < 6 then
  565.  --                     target.stack = 4
  566.  --                 end
  567.     --          target.time = GetGameTimer()
  568.     --      elseif obj.name == "Kalista_Base_E_Spear_tar3.troy" then
  569.     --          if target.stack < 6 then
  570.  --                     target.stack = 3
  571.  --                 end
  572.     --          target.time = GetGameTimer()
  573.     --      elseif obj.name == "Kalista_Base_E_Spear_tar2.troy" then
  574.     --          if target.stack < 6 then
  575.  --                     target.stack = 2
  576.  --                 end
  577.     --          target.time = GetGameTimer()
  578.     --      elseif obj.name == "Kalista_Base_E_Spear_tar1.troy" then
  579.     --          if target.stack < 6 then
  580.  --                     target.stack = 1
  581.  --                 end
  582.     --          target.time = GetGameTimer()
  583.     --      end
  584.     --  end
  585.     -- end
  586.  
  587.     for i,monster in pairs(monsters) do --name = baron level
  588.         for j,camp in pairs(monster.camps) do
  589.             for k,creepPack in ipairs(camp.creeps) do
  590.                 for l,creep in ipairs(creepPack) do
  591.                     if creep.object ~= nil and creep.object.valid and creep.object.dead == false and GetDistance(creep.object,obj) < 80 then
  592.                         if obj.name == "Kalista_Base_E_Spear_tar6.troy" then
  593.                             if creep.stack < 6 then
  594.                                 creep.stack = 6
  595.                             end
  596.                             creep.time = GetGameTimer()
  597.  
  598.                         elseif obj.name == "Kalista_Base_E_Spear_tar5.troy" then
  599.                             if creep.stack < 6 then
  600.                                 creep.stack = 5
  601.                             end
  602.                             creep.time = GetGameTimer()
  603.                         elseif obj.name == "Kalista_Base_E_Spear_tar4.troy" then
  604.                             if creep.stack < 6 then
  605.                                 creep.stack = 4
  606.                             end
  607.                             creep.time = GetGameTimer()
  608.                         elseif obj.name == "Kalista_Base_E_Spear_tar3.troy" then
  609.                             if creep.stack < 6 then
  610.                                 creep.stack = 3
  611.                             end
  612.                             creep.time = GetGameTimer()
  613.                         elseif obj.name == "Kalista_Base_E_Spear_tar2.troy" then
  614.                             if creep.stack < 6 then
  615.                                 creep.stack = 2
  616.                             end
  617.                             creep.time = GetGameTimer()
  618.                         elseif obj.name == "Kalista_Base_E_Spear_tar1.troy" then
  619.                             if creep.stack < 6 then
  620.                                 creep.stack = 1
  621.                             end
  622.                             creep.time = GetGameTimer()
  623.                         end
  624.                     end
  625.                 end
  626.             end
  627.         end
  628.     end
  629. end
  630.  
  631. function OnProcessSpell(unit, spell)
  632.     if unit.isMe then
  633.         if spell.name == spellE.name then
  634.             --PrintChat(spell.name .. " was cast! Stacks cleared!")
  635.             for i, target in pairs(enemyHeroes) do
  636.                 target.stack = 0
  637.             end
  638.         end
  639.  
  640.         for i,monster in pairs(monsters) do --name = baron level
  641.             for j,camp in pairs(monster.camps) do
  642.                 for k,creepPack in ipairs(camp.creeps) do
  643.                     for l,creep in ipairs(creepPack) do
  644.                         creep.stack = 0
  645.                     end
  646.                 end
  647.             end
  648.         end
  649.  
  650.         if spell.name:lower():find("attack") then
  651.             --PrintChat(spell.target.name)
  652.             --PrintChat(tostring(spell.windUpTime))
  653.             -- for i, target in pairs(enemyHeroes) do
  654.             --  if spell.target == target.object then
  655.             --      if target.stack > 5 then
  656.             --          DelayAction(function() target.stack = target.stack + 1 end,spell.windUpTime)
  657.             --      end
  658.             --  end
  659.             -- end
  660.  
  661.             for i,monster in pairs(monsters) do --name = baron level
  662.                 for j,camp in pairs(monster.camps) do
  663.                     for k,creepPack in ipairs(camp.creeps) do
  664.                         for l,creep in ipairs(creepPack) do
  665.                             if spell.target == creep.object then
  666.                                 if creep.stack > 5 then
  667.                                     DelayAction(function() creep.stack = creep.stack + 1 end,spell.windUpTime)
  668.                                 end
  669.                             end
  670.                         end
  671.                     end
  672.                 end
  673.             end
  674.         end
  675.     end
  676. end
  677.  
  678. function packetCast(id, param1, param2)
  679.     if param1 ~= nil and param2 ~= nil then
  680.     Packet("S_CAST", {spellId = id, toX = param1, toY = param2, fromX = param1, fromY = param2}):send()
  681.     elseif param1 ~= nil then
  682.     Packet("S_CAST", {spellId = id, toX = param1.x, toY = param1.z, fromX = param1.x, fromY = param1.z, targetNetworkId = param1.networkID}):send()
  683.     else
  684.     Packet("S_CAST", {spellId = id, toX = player.x, toY = player.z, fromX = player.x, fromY = player.z, targetNetworkId = player.networkID}):send()
  685.     end
  686. end
  687.  
  688. -- function DelayAddStack(i)
  689. --  local target = enemyHeroes[i]
  690. --  if target~= nil then
  691. --      target.stack = target.stack + 1
  692. --  end
  693. -- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement