Advertisement
samipote

WIP Zyra By Samipote

Apr 2nd, 2014
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.28 KB | None | 0 0
  1. require "Utils"
  2. require 'vals_lib'
  3. require 'spell_damage'
  4. print=printtext
  5. printtext("\nZyra\n")
  6. printtext("\nBy Malbert\n")
  7. printtext("\nVersion 2.3\n")
  8.  
  9. local target
  10. local target600
  11. local targetignite
  12. local Etimer=0
  13. local modcounter=0
  14. local Qdmg = 0
  15. local QTdmg = 0
  16. local Edmg = 0
  17. local ETdmg = 0
  18. local Rdmg = 0
  19. local RTdmg = 0
  20. local Wdmg = 0
  21. local WTdmg = 0
  22. local planting = false
  23. local timer0 = 0
  24. local timer1 = 0
  25. local Q,W,E,R = 'Q','W','E','R'
  26.  
  27.  
  28.     KazyZyra = scriptConfig('Zyra Config', 'Zyraconfig')
  29.    
  30.     KazyZyra:addParam('combo', 'Burst Combo', SCRIPT_PARAM_ONKEYDOWN, false, 84)
  31.     KazyZyra:addParam('ult', 'Ult in Combo', SCRIPT_PARAM_ONKEYTOGGLE, true, 55)
  32.     KazyZyra:addParam('Killsteal', 'Killsteal', SCRIPT_PARAM_ONKEYTOGGLE, true, 55)
  33.     KazyZyra:addParam("igniteks", "Ignite KillSteal", SCRIPT_PARAM_ONKEYTOGGLE, true, 119)
  34.    
  35.    
  36. function Run()
  37.     target = GetWeakEnemy('MAGIC',1100)
  38.     targetignite = GetWeakEnemy('TRUE',600)
  39.     if KazyZyra.combo then Combo() end
  40.     if KazyZyra.Killsteal then Killsteal() end
  41.     if KazyZyra.igniteks then ignite() end
  42.     GetCD()
  43.     end
  44.  
  45. function Combo()
  46. if target~=nil and QRDY == 1 and ERDY == 0 and GetD2(target)<800 then
  47. CastSpellXYZ("Q",target.x,target.y,target.z)
  48. end
  49. if GetMEC(1100, 700, target)~=nil and RRDY == 1 and KazyZyra.ult then
  50. CastSpellXYZ("R",target.x,0,target.z)
  51. end
  52. if target~=nil and ERDY == 1 and GetD2(target)<1100 then
  53. Sprediction(E,target,2,1100,22,myHero,0)
  54. end
  55. if target~=nil and WRDY == 1 and GetD2(target)<825 then
  56. CastSpellXYZ("W",target.x,target.y,target.z)
  57. end
  58. if target~=nil and QRDY == 1 and GetD2(target)<800 then
  59. CastSpellXYZ("Q",target.x,target.y,target.z)
  60. end
  61. end
  62. function OnCreateObj(obj)
  63.  
  64.     if target~=nil then
  65.     if obj~=nil and ZyraConfig.combo then
  66.     --printtext("\n1 " .. obj.charName .. "")
  67.         if string.find(obj.charName,"Zyra_E_sequence_impact") and GetDistance(myHero, target) < 1100 and Etimer+5<os.clock() then
  68.             Etimer=os.clock()
  69.         elseif string.find(obj.charName,"Zyra_E_sequence_impact") and GetDistance(myHero, target) < 825 and Etimer+5>os.clock() then
  70.             CastSpellXYZ("W",target.x,0,target.z)  
  71.         end
  72.        
  73.         if string.find(obj.charName,"Zyra_W_cas_02") and GetDistance(myHero, target) < 800 then
  74.  
  75.                 CastSpellXYZ("Q",target.x,0,target.z)          
  76.  
  77.         end    
  78.         if string.find(obj.charName,"zyra_Q_cas") and GetDistance(myHero, target) < 825 then
  79.             if CanUseSpell('W')==1 then
  80.                 CastSpellXYZ("W",target.x,0,target.z)          
  81.             end
  82.         end
  83.                 if string.find(obj.charName,"zyra_emote_death_sound") then
  84.                         planting = true
  85.                         timer1 = GetTickCount()                
  86.         end
  87.         if (string.find(obj.charName,"Zyra_ult_cas_target_center") or (string.find(obj.charName,"seed") and not ZyraConfig.ult)) and GetDistance(myHero, target) < 800 then
  88.             if GetMEC(550,800,target)~=nil then
  89.                 CastSpellXYZ("Q",GetMEC(550,800,target).x,GetMEC(550,800,target).y,GetMEC(550,800,target).z)
  90.             else
  91.                 CastSpellXYZ("Q",target.x,target.y,target.z)   
  92.             end    
  93.  
  94.         end    
  95.        
  96.     end
  97.     end
  98.     end
  99. function Killsteal()
  100. if target~=nil then
  101. Qdmg = ((35+35*GetSpellLevel('Q')+myHero.ap*65/100)*QRDY)
  102. QTdmg = CalcMagicDamage(target,Qdmg)
  103. Edmg = ((25+35*GetSpellLevel('E')+myHero.ap*50/100)*ERDY)
  104. ETdmg = CalcMagicDamage(target,Edmg)
  105. Rdmg = ((95+85*GetSpellLevel('R')+myHero.ap*70/100)*RRDY)
  106. RTdmg = CalcMagicDamage(target,Rdmg)
  107. Wdmg = ((16.5+6.5*myHero.selflevel+myHero.ap*20/100)*WRDY)*4
  108. WTdmg = CalcMagicDamage(target,Wdmg)
  109. if target.health<QTdmg and GetD2(target)<800 then
  110. CastSpellXYZ("Q",target.x,target.y,target.z)
  111. end
  112. if target.health<ETdmg and GetD2(target)<1100 then
  113. Sprediction(E,target,2,1100,22,myHero,0)
  114. end
  115. if target.health<ETdmg+QTdmg and GetD2(target)<1100 and QRDY == 1 then
  116. Sprediction(E,target,2,1100,22,myHero,0)
  117. if GetD2(target)<800 then
  118. CastSpellXYZ("Q",target.x,target.y,target.z)
  119. end
  120. end
  121. if target.health<RTdmg+200 and GetMEC(1100, 700, target)~=nil then
  122. CastSpellXYZ("R",target.x,0,target.z)
  123. end
  124. if target.health<ETdmg+QTdmg+RTdmg and GetMEC(1100, 700, target)~=nil and QRDY == 1 and ERDY == 1 and RRDY == 1 then
  125. CastSpellXYZ("R",target.x,0,target.z)
  126. CastSpellXYZ(W,target.x,target.y,target.z)
  127. Sprediction(E,target,2,1100,22,myHero,0)
  128. CastSpellXYZ("Q",target.x,target.y,target.z)
  129. end
  130. end
  131. end
  132. function ignite()
  133.     local damage = (myHero.selflevel*20)+50
  134.     if targetignite ~= nil then
  135.         if myHero.SummonerD == 'SummonerDot' then
  136.             if targetignite.health < damage then
  137.                 CastSpellTarget('D',targetignite)
  138.             end
  139.         end
  140.         if myHero.SummonerF == 'SummonerDot' then
  141.             if targetignite.health < damage then
  142.                 CastSpellTarget('F',targetignite)
  143.             end
  144.         end
  145.     end
  146.     end
  147.    
  148. function Sprediction(spell,unit,delay,range,speed,from,block,radius)
  149. local d1 = GetD2(unit)
  150. local x, y, z = GetFireahead(unit,5,0)
  151. local d2 = GetD2({x=x, y=y, z=z})
  152. local d3 = GetD2({x=x, y=y, z=z},unit)
  153. local angle = math.acos((d2*d2-d3*d3-d1*d1)/(-2*d3*d1)*2)
  154. local ms = unit.movespeed
  155. local speed=speed
  156. local from = from or Vector(myHero)
  157. local CastPosition = unit.x, unit.y, unit.z
  158. local Position = myHero.x,myHero.y,myHero.z
  159. local delay = delay or (GetDistance(from, unit) / speed)
  160. local velocity = (Position + (((speed * speed + speed) * ms) / 2) - CastPosition) * -1 / ms
  161. local targetposition = Position + (ms * velocity) + ((( ms * ms + ms) * delay/2) / 2)
  162. local FX,FY,FZ = unit.x, unit.y, unit.z
  163. if unit~= nil and targetposition<range and block == 0  then
  164. CastSpellXYZ(spell,FX,FY,FZ)
  165. elseif unit~= nil and targetposition<range and  block == 1 and CreepBlock(GetFireahead(unit,delay,speed)) == 0 then
  166. CastSpellXYZ(spell,FX,FY,FZ)
  167. end
  168. end
  169. function GetD2(p1, p2)
  170.         if p2 == nil then p2 = myHero end
  171.     if (p1.z == nil or p2.z == nil) and p1.x~=nil and p1.y ~=nil and p2.x~=nil and p2.y~=nil then
  172.         px=p1.x-p2.x
  173.         py=p1.y-p2.y
  174.         if px~=nil and py~=nil then
  175.             px2=px*px
  176.             py2=py*py
  177.             if px2~=nil and py2~=nil then
  178.                 return math.sqrt(px2+py2)
  179.             else
  180.                 return 99999
  181.             end
  182.         else
  183.             return 99999
  184.         end
  185.  
  186.     elseif p1.x~=nil and p1.z ~=nil and p2.x~=nil and p2.z~=nil then
  187.         px=p1.x-p2.x
  188.         pz=p1.z-p2.z
  189.         if px~=nil and pz~=nil then
  190.             px2=px*px
  191.             pz2=pz*pz
  192.             if px2~=nil and pz2~=nil then
  193.                 return math.sqrt(px2+pz2)
  194.             else
  195.                 return 99999
  196.             end
  197.         else    
  198.             return 99999
  199.         end
  200.  
  201.     else
  202.                 return 99999
  203.     end
  204. end
  205.  
  206. SetTimerCallback("Run")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement