16HeX16

Trundle - Time to Troll

Mar 30th, 2013
1,614
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.82 KB | None | 0 0
  1. if myHero.charName ~= "Trundle" then return end
  2.  
  3. require 'OnWindUp'
  4. require 'VPrediction'
  5.  
  6. local VP = VPrediction()
  7. local qRange, wRange, eRange, rRange = 300, 900, 1000, 700
  8.  
  9. function OnLoad()
  10.     PrintChat("<font color='#CCCCCC'> >> Trundle - Time to Troll loaded <<</font>")
  11.    
  12.     TrundleConfig = scriptConfig("Trundle - Time to Troll", "Trundle_Time_to_Troll")
  13.     TrundleConfig:addParam("scriptActive", "Combo", SCRIPT_PARAM_ONKEYDOWN, false, 32)
  14.     TrundleConfig:addParam("pillarBlock", "Block with Pillar", SCRIPT_PARAM_ONKEYDOWN, false, string.byte("G"))
  15.     TrundleConfig:addParam("useUlt", "Use Ultimate in Combo", SCRIPT_PARAM_ONKEYTOGGLE, true, string.byte("H"))
  16.     TrundleConfig:addParam("dynaPillar", "Dynamic Pillar Control", SCRIPT_PARAM_ONKEYTOGGLE, true, string.byte("T"))
  17.    
  18.     TrundleConfig:permaShow("dynaPillar")
  19.     TrundleConfig:permaShow("useUlt")
  20.    
  21.     ts = TargetSelector(TARGET_LESS_CAST_PRIORITY, qRange+100, DAMAGE_PHYSICAL, true)
  22.     es = TargetSelector(TARGET_LESS_CAST_PRIORITY, eRange+100, DAMAGE_PHYSICAL, true)
  23.     ts.name = "Trundle"
  24.     TrundleConfig:addTS(ts)
  25. end
  26.  
  27. function OnTick()
  28.     ts:update()
  29.     es:update()
  30.    
  31.     QREADY = (myHero:CanUseSpell(_Q) == READY)
  32.     WREADY = (myHero:CanUseSpell(_W) == READY)
  33.     EREADY = (myHero:CanUseSpell(_E) == READY)
  34.     RREADY = (myHero:CanUseSpell(_R) == READY)
  35.  
  36.     if EREADY and TrundleConfig.pillarBlock then
  37.         if ts.target then
  38.             BlockwithPillar(ts.target)
  39.         elseif es.target then
  40.             BlockwithPillar(es.target)
  41.         end
  42.     end
  43.    
  44.     if TrundleConfig.scriptActive then
  45.         if ts.target then
  46.             if QREADY and GetDistance(ts.target) < qRange then
  47.                 if ts.target.health <= getDmg("Q", ts.target, myHero) then CastSpell(_Q) end
  48.             end
  49.             if WREADY then
  50.                 if GetDistance(ts.target) <= 400 then  
  51.                     CastSpell(_W, myHero.x, myHero.z)
  52.                 elseif GetDistance(ts.target) >= 400 and GetDistance(ts.target) <= wRange then
  53.                     CastSpell(_W, ts.target.x, ts.target.z)
  54.                 end
  55.             end
  56.             if EREADY and ts.target.health <= ts.target.maxHealth*0.25 then
  57.                 BlockwithPillar(ts.target)
  58.             end
  59.             if RREADY and TrundleConfig.useUlt and GetDistance(ts.target) < rRange then
  60.                 CastSpell(_R, ts.target)
  61.             end
  62.         elseif es.target and es.target.health <= es.target.maxHealth*0.25 then
  63.             BlockwithPillar(es.target)
  64.         end
  65.     end
  66. end
  67.  
  68. function OnWindUp(unit, attack)
  69.     if unit.isMe and ts.target and GetDistance(ts.target) < 225 then CastSpell(_Q) end
  70. end
  71.  
  72. function BlockwithPillar(target)
  73.     if TrundleConfig.dynaPillar then
  74.         local ePred, HitChance = VP:GetCircularCastPosition(target, 0.25, 120, eRange)
  75.         if ePred then
  76.             local blockPos = ePred + (Vector(myHero) - ePred):normalized()*50
  77.             if blockPos then CastSpell(_E, blockPos.x, blockPos.z) end
  78.         end
  79.     else
  80.         local blockPos = target + (Vector(myHero) - target):normalized()*75
  81.         if blockPos then CastSpell(_E, blockPos.x, blockPos.z) end
  82.     end
  83. end
Advertisement
Add Comment
Please, Sign In to add comment