samipote

Zyra

May 26th, 2018
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 8.21 KB | None | 0 0
  1. require "Utils"
  2. require 'yprediction'
  3. require 'spell_shot'
  4. require 'spell_damage'
  5. local planting = false
  6. local Etimer=0
  7. local timer0 = 0
  8. local timer1 = 0
  9. local target
  10. local YP = YPrediction()
  11. local t0_attacking = 0
  12. local IgniteDmg = 0
  13. local haveIgnite = false
  14. local igniteKey
  15. local shotMe = false
  16. local Q = {range = 800, rangeSqr = math.pow(800, 2), width = 50, delay = 1.8, speed = 0, LastCastTime = 0}
  17. local E = {range = 1100, rangeSqr = math.pow(1050, 2), width = 70, delay = 1.25, speed = 0, LastCastTime = 0, ETA=math.huge}
  18. local W = {range = 825, rangeSqr = math.pow(850, 2), width = 0, delay = 0, speed = 0, LastCastTime = 0,}
  19. local R = {range = 700, rangeSqr = math.pow(700, 2), width = 500, delay = 2.5, speed = 0, LastCastTime = 0}
  20. local DontUseRTime = 0
  21. local UseRTime = 0
  22. ZyraHotkeys = scriptConfig("HotKeys Settings", "Samipote's Zyra")
  23. ZyraHotkeys:addParam("Combo", "Combo", SCRIPT_PARAM_ONKEYDOWN, false, string.byte("X"))
  24. ZyraHotkeys:addParam("Harass", "Harass!", SCRIPT_PARAM_ONKEYTOGGLE, true, string.byte("Z"))
  25. ZyraCombo = scriptConfig("Combo Settings", "Samipote's Zyra")
  26. ZyraCombo:addParam("UseQ", "Use Q", SCRIPT_PARAM_ONOFF,true)
  27. ZyraCombo:addParam("UseQW", "Use QW", SCRIPT_PARAM_ONOFF,true)
  28. ZyraCombo:addParam("UseE", "Use E", SCRIPT_PARAM_ONOFF,true)
  29. ZyraCombo:addParam("UseEW", "Use EW", SCRIPT_PARAM_ONOFF,true)
  30. ZyraCombo:addParam("UseR", "Use R", SCRIPT_PARAM_ONOFF,true)
  31. ZyraHarass = scriptConfig("Harass Settings", "Samipote's Zyra")
  32. ZyraHarass:addParam("UseQ", "Use Q", SCRIPT_PARAM_ONOFF,true)
  33. ZyraHarass:addParam("UseQW", "Use QW", SCRIPT_PARAM_ONOFF,true)
  34. ZyraHarass:addParam("UseE", "Use E", SCRIPT_PARAM_ONOFF,true)
  35. ZyraHarass:addParam("UseEW", "Use EW", SCRIPT_PARAM_ONOFF,true)
  36. ZyraHarass:addParam("ManaCheck", "ManaCheck", SCRIPT_PARAM_ONOFF,true)
  37. function OnTick()
  38. target = GetWeakEnemy('Magic',1050)
  39. if ZyraHotkeys.Combo and target then
  40. Combo()
  41. elseif ZyraHotkeys.Harass then
  42. Harass()
  43. end
  44. IgniteDmg = 50 + (20 * myHero.selflevel)
  45. if haveIgnite and GetDistance(target) <= 600 and IgniteDmg>target.health then
  46. CastSpellTarget(igniteKey, target)
  47. end
  48. end
  49. function Combo()
  50. UseSpells(ZyraCombo.UseQ, ZyraCombo.UseQW, ZyraCombo.UseE, ZyraCombo.UseEW, ZyraCombo.UseR, false)
  51. castE()
  52. end
  53. function Harass()
  54. if ZyraHarass.ManaCheck and 25 > (myHero.mana / myHero.maxMana) * 100 then return end
  55. UseSpells(ZyraHarass.UseQ, ZyraHarass.UseQW, ZyraHarass.UseE, ZyraHarass.UseEW, false)
  56. castE()
  57. end
  58. function OnProcessSpell(unit, spell)
  59. if unit.charName == myHero.charName then
  60. if spell.name == "ZyraQFissure" then
  61. Q.LastCastTime = os.clock()
  62. Q.LastPos = spell.endPos
  63. Q.seedcasted = false
  64. DelayAction(function() Q.seedcasted = true end, Q.delay)
  65. elseif spell.name == "ZyraSeed" then    
  66. W.LastCastTime = os.clock()
  67. elseif spell.name == "ZyraGraspingRoots" then    
  68. E.LastCastTime = os.clock()
  69. E.seedcasted = false
  70. DelayAction(function() E.seedcasted = true end, E.delay + (E.range / E.speed))
  71. elseif spell.name == "ZyraBrambleZone" then    
  72. R.LastCastTime = os.clock()
  73. end
  74. end
  75. end
  76. local shot = SpellShotTarget(unit, spell, myHero)
  77. if shot ~= nil then
  78. spellShot = shot
  79. if spellShot.shot then
  80. shotMe = true
  81. target = unit    
  82. end
  83. end
  84. function UseSpells(UseQ, UseQW, UseE, UseEW, UseR, RN)
  85. local Qtarget
  86. local Etarget
  87. Qtarget = GetWeakEnemy('MAGIC',Q.range + Q.width,'NEARMOUSE')
  88. Etarget = GetWeakEnemy('MAGIC',E.range,'NEARMOUSE')
  89. if Qtarget then
  90. Etarget = Qtarget
  91. end
  92. if UseQW  then
  93. for i = 1, objManager:GetMaxHeroes(), 1 do
  94. local enemy = objManager:GetHero(i)
  95. local CastPosition,  HitChance,  Position = YP:GetPredictedPos(enemy, Q.delay,Q.speed, myHero, false)
  96. if CastPosition and CastPosition.z and HitChance >= 2 and (enemy ~= nil and enemy.team ~= myHero.team and enemy.visible == 1 and enemy.invulnerable == 0 and enemy.dead == 0) and GetDistance(enemy) <= W.range then
  97. local x, y, z = CastPosition.x, CastPosition.y, CastPosition.z  
  98. CastSpellXYZ("Q", x, y, z)
  99. break
  100. end
  101. end
  102. end
  103. if UseEW  then
  104. for i = 1, objManager:GetMaxHeroes(), 1 do
  105. local enemy = objManager:GetHero(i)
  106. if (enemy ~= nil and enemy.team ~= myHero.team and enemy.visible == 1 and enemy.invulnerable == 0 and enemy.dead == 0) and GetDistance(enemy) <= W.range then
  107. local CastPosition,  HitChance,  Position = YP:GetPredictedPos(enemy, E.delay, E.speed, myHero, false)
  108. if CastPosition and CastPosition.z and HitChance >= 2  and GetDistance(enemy) <= W.range then
  109. local x, y, z = CastPosition.x, CastPosition.y, CastPosition.z
  110. CastSpellXYZ("W", x, y, z)
  111. break
  112. end
  113. end
  114. end
  115. end
  116. if UseE and ERDY  then
  117. castE()
  118. end
  119. if UseQ and QRDY and Qtarget then
  120. local CastPosition,  HitChance,  Position = YP:GetLineCastPosition(Qtarget, Q.delay, Q.width, Q.range, Q.speed, myHero, false)
  121. if CastPosition  and HitChance>=1  then
  122. Q.LastPos = CastPosition
  123. CastSpellXYZ("Q",CastPosition.x, CastPosition.y, CastPosition.z)
  124. end
  125. end
  126. end
  127. if UseR then
  128. HaveIgnite()
  129. if Qtarget or Etarget then
  130. if Qtarget and ((GetDistanceSqr(Qtarget, myHero) < R.rangeSqr and not getDmg("Q",Qtarget,myHero))) then
  131. UseAllItems(Qtarget)
  132. if haveIgnite and GetDistanceSqr(Qtarget, myHero) < 600 * 600 then
  133. CastSpellTarget(igniteKey, Qtarget)
  134. end
  135. local mainCastPosition = YP:GetCircularAOECastPosition(Qtarget, R.delay,R.width, R.range, R.speed, myHero,false)
  136. if mainCastPosition and mainCastPosition.z then
  137. CastSpellXYZ("R",mainCastPosition.x, mainCastPosition.y, mainCastPosition.z)
  138. end
  139. end
  140. end
  141. end
  142. function castE()
  143. for i = 1, objManager:GetMaxHeroes(), 1 do
  144. local enemy = objManager:GetHero(i)
  145. if (enemy ~= nil and enemy.team ~= myHero.team and enemy.visible == 1 and enemy.invulnerable == 0 and enemy.dead == 0) and GetDistance(enemy) < W.range then
  146. local CastPosition,  HitChance,  Position = YP:GetLineCastPosition(enemy, E.delay, E.width, E.range, E.speed, myHero, false)
  147. if CastPosition  then
  148. local x, y, z = CastPosition.x, CastPosition.y, CastPosition.z
  149. CastSpellXYZ("E", x, y, z)
  150. end
  151. end
  152. end
  153. end
  154. function OnCreateObj(obj)
  155. if target~=nil then
  156. if obj~=nil and ZyraHotkeys.Combo or ZyraHotkeys.Harass then
  157. if string.find(obj.charName,"Zyra_E_sequence_impact") and GetDistance(myHero, target) < 1100 and Etimer+5<os.clock() then
  158. Etimer=os.clock()
  159. elseif string.find(obj.charName,"Zyra_E_sequence_impact") and GetDistance(myHero, target) < W.range and Etimer+5>os.clock() then
  160. CastSpellXYZ("W",target.x,0,target.z)  
  161. end
  162. if string.find(obj.charName,"Zyra_W_cas_02") and GetDistance(myHero, target) < 800 then
  163. CastSpellXYZ("Q",obj.x,0,obj.z)
  164. end
  165. if string.find(obj.charName,"zyra_Q_cas") and GetDistance(myHero, target) < W.range then
  166. if CanUseSpell('W')==1 then
  167. CastSpellXYZ("W",obj.x,0,obj.z)                  
  168. end
  169. end    
  170. if (string.find(obj.charName,"Zyra_ult_cas_target_center") or (string.find(obj.charName,"seed") and not ZyraCombo.UseR)) and GetDistance(myHero, target) < 800 then
  171. if GetMEC(550,800,target)~=nil and target.dead == 0 then
  172. CastSpellXYZ("Q",GetMEC(550,800,target).x,GetMEC(550,800,target).y,GetMEC(550,800,target).z)
  173. elseif not ERDY and not QRDY and ZyraCombo.UseR  then
  174. CastSpellXYZ("R",target.x,target.y,target.z)  
  175. end            
  176. end            
  177. end
  178. end
  179. end
  180. function HaveIgnite()
  181. if myHero.SummonerD == "SummonerDot" then
  182. if myHero.SpellTimeD > 1 then          
  183. haveIgnite = true
  184. igniteKey = 'D'
  185. else
  186. haveIgnite = false
  187. igniteKey = 'D'
  188. end
  189. elseif myHero.SummonerF == "SummonerDot" then
  190. if myHero.SpellTimeF > 1 then          
  191. haveIgnite = true
  192. igniteKey = 'F'
  193. else
  194. haveIgnite = false
  195. igniteKey = 'F'
  196. end
  197. else
  198. haveIgnite = false
  199. igniteKey = nil
  200. end          
  201. return haveIgnite, igniteKey
  202. end
  203. function GetCD()
  204. if myHero.SpellTimeQ > 1 and GetSpellLevel('Q') > 0 then
  205. QRDY = true
  206. else QRDY = false
  207. end
  208. if myHero.SpellTimeW > 1 and GetSpellLevel('W') > 0 then
  209. WRDY = true
  210. else WRDY = false
  211. end
  212. if myHero.SpellTimeE > 1 and GetSpellLevel('E') > 0 then
  213. ERDY = true
  214. else ERDY = false
  215. end
  216. if myHero.SpellTimeR > 1 and GetSpellLevel('R') > 0 then
  217. RRDY = true
  218. else RRDY = false end
  219. end
  220. function checkspells()
  221. if myHero.SpellTimeW > 1 and GetSpellLevel('W') > 0 then
  222. WRDY2 = 1
  223. else WRDY2 = 0
  224. end
  225. if myHero.SpellTimeE > 1 and GetSpellLevel('E') > 0 then
  226. ERDY2 = 1
  227. else ERDY2 = 0
  228. end
  229. if myHero.SpellTimeR > 1 and GetSpellLevel('R') > 0 then
  230. RRDY2 = 1
  231. else RRDY2 = 0 end
  232. end
  233. SetTimerCallback("OnTick")
Advertisement
Add Comment
Please, Sign In to add comment