samipote

Samipote's Katarina wip v.0.1

Jun 29th, 2014
391
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 11.56 KB | None | 0 0
  1. require 'Utils'
  2. local target
  3. local minion
  4. local ulti=false
  5. local allyTable = {}
  6. local enemyTable = {}
  7. local ally = nil
  8. local enemy = nil
  9. local currentally = nil
  10. local timeulti = 0
  11. local timeulti2 = 0
  12. local delayult = 300
  13. local delayult2 = 1200
  14. local timeq = 0
  15. local target2
  16. local lastqmark = 0
  17. local player=myHero
  18. local distancetstarget = 0
  19. local esavehealth = myHero.health*0.20
  20. local DFGSlot=GetInventorySlot(3128)
  21. local HXGSlot=GetInventorySlot(3146)
  22. local BWCSlot=GetInventorySlot(3144)
  23. KatarinaConfig = scriptConfig("Samipote's Katarina", "Samipote's Katarina")
  24. KatarinaConfig:addParam("Combo", "Combo", SCRIPT_PARAM_ONKEYDOWN, false, string.byte("X"))
  25. KatarinaConfig:addParam("Killsteal", "Killsteal", SCRIPT_PARAM_ONOFF,true)
  26. KatarinaConfig:addParam("Farm", "Auto-Farm", SCRIPT_PARAM_ONKEYTOGGLE, true, string.byte("C"))
  27. KatarinaConfig:addParam("Autoe", "Auto-E Escape", SCRIPT_PARAM_ONOFF,true)
  28. KatarinaConfig:addParam('Items', 'Items', SCRIPT_PARAM_ONOFF, true)
  29. KatarinaConfig:addParam("Ignite", "AutoIgnite", SCRIPT_PARAM_ONOFF,true)
  30.  
  31. function main()
  32. GetCD()
  33. target = GetWeakEnemy('MAGIC',math.max(QREADY*675,WREADY*375,EREADY*700,RREADY*550,1),'NEARMOUSE')
  34. minion = GetLowestHealthEnemyMinion(675)
  35. for i = 1, objManager:GetMaxHeroes()  do
  36. enemy = objManager:GetHero(i)
  37. if (enemy ~= nil and enemy.team ~= myHero.team and enemy.visible == 1 and enemy.invulnerable == 0 and enemy.dead == 0) then
  38. table.insert(enemyTable, enemy)
  39. end
  40. end
  41. for i = 1, objManager:GetMaxHeroes() do
  42. ally = objManager:GetHero(i)
  43. if (ally ~= nil and ally.team == myHero.team and ally.visible == 1 and ally.dead==0) then
  44. table.insert(allyTable, ally)
  45. end
  46. end
  47. if target ~= nil then distancetstarget = GetDistance(target) end
  48. ulti = false
  49. if IsBuffed(target,'KatarinaRSound',550)==true then
  50. ulti = true
  51. timeulti = GetTickCount()
  52. end
  53. if GetTickCount()-timeulti < delayult or GetTickCount()-timeulti2 < delayult2 then ulti = true end
  54. ItemCD()
  55. Combo()
  56. Killsteal()
  57. Farm()
  58. Autoe()
  59. Ignite()
  60. Items()
  61. end
  62. function GetCD()
  63. if myHero.SpellTimeQ > 1 and GetSpellLevel("Q") > 0 then
  64. QREADY = 1
  65. else QREADY = 0
  66. end
  67. if myHero.SpellTimeW > 1 and GetSpellLevel("W") > 0 then
  68. WREADY = 1
  69. else WREADY = 0
  70. end
  71. if myHero.SpellTimeE > 1 and GetSpellLevel("E") > 0 then
  72. EREADY = 1
  73. else EREADY = 0
  74. end
  75. if myHero.SpellTimeR > 1 and GetSpellLevel("R") > 0 then
  76. RREADY = 1
  77. else RREADY = 0 end
  78. end
  79. function IsBuffed(target,name,range)
  80. for i = 1, objManager:GetMaxObjects(), 1 do
  81. obj = objManager:GetObject(i)
  82. if obj~=nil and target~=nil and string.find(obj.charName,name) and ((range==nil and GetDistance(obj,target)<150) or (range~=nil and GetDistance(obj,target)<=range)) then
  83. return true
  84. end
  85. end
  86. end
  87. function ItemCD()
  88. if GetInventorySlot(3128)==1 and myHero.SpellTime1 >= 1 then DFGREADY  = 1
  89. elseif GetInventorySlot(3128)==2 and myHero.SpellTime2 >= 1 then DFGREADY  = 1
  90. elseif GetInventorySlot(3128)==3 and myHero.SpellTime3 >= 1 then DFGREADY  = 1
  91. elseif GetInventorySlot(3128)==4 and myHero.SpellTime4 >= 1 then DFGREADY  = 1
  92. elseif GetInventorySlot(3128)==5 and myHero.SpellTime5 >= 1 then DFGREADY  = 1
  93. elseif GetInventorySlot(3128)==6 and myHero.SpellTime6 >= 1 then DFGREADY  = 1
  94. else DFGREADY = 0
  95. end
  96. if GetInventorySlot(3144)==1 and myHero.SpellTime1 >= 1 then BWCREADY = 1
  97. elseif GetInventorySlot(3144)==2 and myHero.SpellTime2 >= 1 then BWCREADY = 1
  98. elseif GetInventorySlot(3144)==3 and myHero.SpellTime3 >= 1 then BWCREADY = 1
  99. elseif GetInventorySlot(3144)==4 and myHero.SpellTime4 >= 1 then BWCREADY = 1
  100. elseif GetInventorySlot(3144)==5 and myHero.SpellTime5 >= 1 then BWCREADY = 1
  101. elseif GetInventorySlot(3144)==6 and myHero.SpellTime6 >= 1 then BWCREADY = 1
  102. else BWCREADY = 0
  103. end
  104. if GetInventorySlot(3146)==1 and myHero.SpellTime1 >= 1 then HXGREADY = 1
  105. elseif GetInventorySlot(3146)==2 and myHero.SpellTime2 >= 1 then HXGREADY = 1
  106. elseif GetInventorySlot(3146)==3 and myHero.SpellTime3 >= 1 then HXGREADY = 1
  107. elseif GetInventorySlot(3146)==4 and myHero.SpellTime4 >= 1 then HXGREADY = 1
  108. elseif GetInventorySlot(3146)==5 and myHero.SpellTime5 >= 1 then HXGREADY = 1
  109. elseif GetInventorySlot(3146)==6 and myHero.SpellTime6 >= 1 then HXGREADY = 1
  110. else HXGREADY = 0
  111. end
  112. end
  113. function Combo()
  114. if KatarinaConfig.Combo and target~=nil and ulti==false and (Killsteal()==false or Killsteal()==nil or not Killsteal()) then
  115. AttackTarget(target)
  116. if DFGREADY==1 then CastSpellTarget(tostring(DFGSlot),target) end
  117. if QREADY==1 then CastSpellTarget("Q",target) end
  118. if EREADY==1 then CastSpellTarget("E",target) end
  119. if WREADY==1 and distancetstarget<375 and (((GetTickCount()-timeq>650 or (GetTickCount()-lastqmark<650) and QREADY==0))) or (RREADY==1) then CastSpellXYZ("W",myHero.x,myHero.y,myHero.z) end
  120. if HXGREADY==1 then CastSpellTarget(tostring(HXGSlot),target) end
  121. if BWCREADY==1 then CastSpellTarget(tostring(BWCSlot),target) end
  122. if RREADY==1 and QREADY==0 and WREADY==0 and EREADY==0 and DFGREADY==0 and HXGREADY==0 and BWCREADY==0 and distancetstarget<275 then
  123. timeulti = GetTickCount()
  124. timeulti2 = GetTickCount()
  125. CastSpellXYZ('R',myHero.x,0,myHero.z)
  126. end
  127. end
  128. end
  129. function MoveMouse()
  130. local moveSqr = math.sqrt((mousePos.x - myHero.x)^2+(mousePos.z - myHero.z)^2)
  131. local moveX = myHero.x + 300*((mousePos.x - myHero.x)/moveSqr)
  132. local moveZ = myHero.z + 300*((mousePos.z - myHero.z)/moveSqr)
  133. MoveToXYZ(moveX,0,moveZ)
  134. end
  135. function Killsteal()
  136. if KatarinaConfig.Killsteal and target~=nil and ulti==false then
  137. local eDmg = CalcMagicDamage(target, 25*(GetSpellLevel("E")-1)+60+(.4*player.ap))
  138. local wDmg = CalcMagicDamage(target, 35*(GetSpellLevel("W")-1) +40+ (.25*player.ap)+(.6*player.addDamage))
  139. local qDmg = CalcMagicDamage(target, 25*(GetSpellLevel("Q")-1)+60+(.45*player.ap))
  140. if target.health < qDmg and GetDistance(target) < 650 and QREADY==1 then
  141. CastSpellTarget("Q",target)
  142. return true
  143. elseif target.health < wDmg and GetDistance(target) < 375 and WREADY==1 then
  144. CastSpellXYZ("W",myHero.x,myHero.y,myHero.z)
  145. return true
  146. elseif GetDistance(target) < 360 and target.health < qDmg + wDmg and QREADY==1 and WREADY==1 then
  147. CastSpellTarget("Q",target)
  148. CastSpellXYZ("W",myHero.x,myHero.y,myHero.z)
  149. return true
  150. elseif GetDistance(target) < 375 and GetDistance(target) > 360 and target.health < qDmg + wDmg and QREADY==1 and WREADY==1 then
  151. CastSpellXYZ("W",myHero.x,myHero.y,myHero.z)
  152. CastSpellTarget("Q",target)
  153. return true
  154. elseif  target.health < eDmg and GetDistance(target) < 700 and EREADY==1 then
  155. CastSpellTarget("E",target)
  156. return true
  157. elseif GetDistance(target) < 700 and GetDistance(target) > 650 and target.health < qDmg + eDmg and QREADY==1 and  EREADY==1 then
  158. CastSpellTarget("E",target)
  159. CastSpellTarget("Q",target)
  160. return true
  161. elseif GetDistance(target) < 650 and target.health < qDmg + eDmg and QREADY==1 and EREADY==1 then
  162. CastSpellTarget("Q",target)
  163. CastSpellTarget("E",target)
  164. return true
  165. elseif GetDistance(target) < 700 and GetDistance(target) > 650 and target.health < wDmg + eDmg + qDmg and QREADY==1 and EREADY==1 and WREADY==1 then
  166. CastSpellTarget("E",target)
  167. CastSpellTarget("Q",target)
  168. CastSpellXYZ("W",myHero.x,myHero.y,myHero.z)
  169. return true
  170. elseif GetDistance(target) < 650 and target.health < wDmg + eDmg + qDmg and QREADY==1 and EREADY==1 and WREADY==1 then
  171. CastSpellTarget("Q",target)
  172. CastSpellTarget("E",target)
  173. CastSpellXYZ("W",myHero.x,myHero.y,myHero.z)
  174. return true
  175. elseif target.health < eDmg and GetDistance(target) < 700 and EREADY==1  then
  176. CastSpellTarget("E",target)
  177. elseif  target.health < wDmg + eDmg and GetDistance(target)<700 and EREADY==1 and WREADY==1 then
  178. CastSpellTarget("E",target)
  179. CastSpellXYZ("W",myHero.x,myHero.y,myHero.z)
  180. return true
  181. else
  182. return false
  183. end
  184. else
  185. return false
  186. end
  187. end
  188. function Farm()
  189. if KatarinaConfig.Farm and minion~=nil and ulti==false and KatarinaConfig.Combo==false and (Killsteal()==false or Killsteal()==nil or not Killsteal()) then
  190. local qDmg2 = CalcMagicDamage(minion, 25*(GetSpellLevel("Q")-1)+60+(.45*player.ap))
  191. if qDmg2>minion.health and QREADY==1 then
  192. CastSpellTarget("Q",minion)
  193. end
  194. local wDmg2 = CalcMagicDamage(minion, 35*(GetSpellLevel("W")-1) +40+ (.25*player.ap)+(.6*player.addDamage))
  195. if wDmg2>minion.health and WREADY==1 and GetDistance(myHero,minion)<375 then
  196. CastSpellXYZ("W",myHero.x,myHero.y,myHero.z)
  197. end
  198. end
  199. end
  200. function Autoe()
  201. if KatarinaConfig.Autoe and ulti==false and Killsteal==false then
  202. if myHero.health < esavehealth and EREADY==1 then
  203. for i, ally in ipairs(allyTable) do
  204. for i, enemy in ipairs(enemyTable) do
  205. if GetDistance(ally) < 700 and GetDistance(enemy) < 2000 then
  206. currentally = ally
  207. elseif currentally ~= nil then
  208. if GetDistance(ally,enemy) > GetDistance(currentally,enemy) and GetDistance(ally,enemy) > GetDistance(enemy) then
  209. currentally = ally
  210. end
  211. end
  212. end
  213. end
  214. end
  215. end
  216. end
  217. if currentally ~= nil then
  218. CastSpellTarget("E",currentally)
  219. currentally = nil
  220. end
  221. function Items()
  222. if KatarinaConfig.Items then
  223. if myHero.health<((myHero.maxHealth/100)*20) and Killsteal()==false then
  224. useZhonyas(myHero)
  225. useWoogletsWitchcap(myHero)
  226. end
  227. if target~=nil and KatarinaConfig.Combo and ulti==false then
  228. useDeathfireGrasp(target)
  229. end
  230. if target~=nil and KatarinaConfig.Combo and ulti==true then
  231. useTwinShadows(myHero)
  232. end
  233. for i, ally in ipairs(allyTable) do
  234. if target~=nil and ally~=nil then
  235. if ally.health<((ally.maxHealth/100)*20) then
  236. useLocketOfTheIronSolari(ally)
  237. end
  238. end
  239. end
  240. if target~=nil and KatarinaConfig.Combo and ulti==false then
  241. useGunblade(target)
  242. end
  243. if target~=nil and KatarinaConfig.Combo and ulti==false then
  244. useHydra(target)
  245. end
  246. if target~=nil and KatarinaConfig.Combo and ulti==false then
  247. useOmen(target)
  248. end
  249. if myHero.dead==1 then
  250. useSoulAnchor(myHero)
  251. end
  252. end
  253. end
  254. function useZhonyas(cible)
  255. if cible~=nil then
  256. GetInventorySlot(3157)
  257. UseItemOnTarget(3157,cible)
  258. end
  259. end
  260. function useDeathfireGrasp(cible)
  261. if cible ~= nil then
  262. GetInventorySlot(3128)
  263. UseItemOnTarget(3128,cible)
  264. end
  265. end
  266. function useTwinShadows(cible)
  267. if cible ~= nil then
  268. GetInventorySlot(3023)
  269. UseItemOnTarget(3023,cible)
  270. end
  271. end
  272. function useWoogletsWitchcap(cible)
  273. if cible~=nil then
  274. GetInventorySlot(3090)
  275. UseItemOnTarget(3090,cible)
  276. end
  277. end
  278. function useLocketOfTheIronSolari(cible)
  279. if cilbe~=nil then
  280. GetInventorySlot(3090)
  281. UseItemOnTarget(3090,cible)
  282. end
  283. end
  284. function useGunblade(cible)
  285. if cible~=nil then
  286. GetInventorySlot(3146)
  287. UseItemOnTarget(3146,cible)
  288. end
  289. end
  290. function useHydra(cible)
  291. if cible~=nil then
  292. GetInventorySlot(3074)
  293. UseItemOnTarget(3074,cible)
  294. end
  295. end
  296. function useOmen(cible)
  297. if cible~=nil then
  298. GetInventorySlot(3143)
  299. UseItemOnTarget(3143,cible)
  300. end
  301. end
  302. function useSoulAnchor(cible)
  303. if cible~=nil then
  304. GetInventorySlot(3345)
  305. UseItemOnTarget(3345,cible)
  306. end
  307. end
  308. function Ignite()
  309. if KatarinaConfig.Ignite then
  310. local damage = 50 + (20 * myHero.selflevel)
  311. target2 = GetWeakEnemy("TRUE", 610)
  312. if target2 ~= nil and myHero.SummonerD == "SummonerDot" and target2.visible and target2.dead ~= 1 and target2.invulnerable ~= 1 and (target2.health < damage or ulti==true) then
  313. if IsSpellReady("D") == 1 then
  314. CastSpellTarget("D",target2)
  315. end
  316. end
  317. if target2 ~= nil and myHero.SummonerF == "SummonerDot" and target2.visible and target2.dead ~= 1 and target2.invulnerable ~= 1 and (target2.health < damage or ulti==true) then
  318. if IsSpellReady("F") == 1 then
  319. CastSpellTarget("F",target2)
  320. end
  321. end
  322. end
  323. end
  324. function OnProcessSpell(unit, spell)
  325. if unit ~= nil and spell ~= nil and unit.charName == myHero.charName and spell.name == 'KatarinaQ' then timeq = GetTickCount() end
  326. end
  327. function OnCreateObj(obj)
  328. if obj~=nil then
  329. if string.find(obj.charName,"katarina_daggered") then
  330. lastqmark = GetTickCount()
  331. end
  332. end
  333. end
  334. SetTimerCallback("main")
Advertisement
Add Comment
Please, Sign In to add comment