Advertisement
Guest User

Master-Yi-burn-v1.5-xkjtx.lua

a guest
Mar 28th, 2013
549
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 15.68 KB | None | 0 0
  1.     --[[
  2.             Master Yi Combo 1.5 by burn
  3.             updated season 3
  4.  
  5.                             --- Made to work by xkjtx
  6.                                 added autoW when low health
  7.      
  8.             -Full combo: Items -> R -> Q -> E
  9.             -Supports Deathfire Grasp, Bilgewater Cutlass, Hextech Gunblade, Sheen, Trinity, Lich Bane, Ignite, Iceborn, Liandrys, Blackfire, || Ravenous Hydra, EXEC, YOGH, RANO and BRK (this part only item activation)
  10.             -Mark killable target with a combo
  11.             -Target configuration, Press shift to configure
  12.             -Mana managament system
  13.             -Option to auto ignite when enemy is killable (this affect also for damage calculation)
  14.             -Option to Auto R-Q on killable enemy
  15.      
  16.             Explanation of the marks:
  17.      
  18.             Green circle: Marks the current target to which you will do the combo
  19.             Blue circle: Mark a target that can be killed with a combo, if all the skills were available
  20.             Red circle: Mark a target that can be killed using Items + 10 hits + Q x2 + ignite
  21.             2 Red circles: Mark a target that can be killed using Items + 5 hit + Q + ignite
  22.             3 Red circles: Mark a target that can be killed using Items (without Sheen, Trinity and Lich Bane) + Q + ignite
  23.     ]]
  24.     if myHero.charName ~= "MasterYi" then return end
  25.  
  26.     local player = GetMyHero()
  27.  
  28.     --[[            Code            ]]
  29.     local range = 600
  30.     local tick = nil
  31.     local WujuStyleActive = false
  32.     local UltimateActive = false
  33.     -- Hot Keys
  34.     local activeCombo = 32
  35.     local hotWkey = string.byte("S") -- Auto W
  36.     local autoRQkey = string.byte("X") -- Auto RQ on killable target(even minions if they have been selected)
  37.  
  38.     --Health percentage % - 0.30 = 30%
  39.     local healthPer = 0.30
  40.    
  41.     -- draw
  42.     local waittxt = {}
  43.     local calculationenemy = 1
  44.     local floattext = {"Skills are not available","Able to fight","Killable","Murder him!"}
  45.     local killable = {}
  46.     -- ts
  47.     local ts
  48.     --
  49.     local ignite = nil
  50.     local WeHaveMana = false
  51.     local DFGSlot, HXGSlot, BWCSlot, SheenSlot, TrinitySlot, LichBaneSlot, YomumusGhostbladeSlot = nil, nil, nil, nil, nil, nil, nil
  52.     local QREADY, WREADY, EREADY, RREADY, DFGREADY, HXGREADY, BWCREADY, IREADY, YomumusGhostbladeReady = false, false, false, false, false, false, false, false, false
  53.      
  54.     function OnLoad()
  55.         --PrintChat(">> MasterYi Combo 1.5 loaded!")
  56.         MYiConfig = scriptConfig("Master Yi Combo", "yicombo")
  57.         MYiConfig:addParam("scriptActive", "Combo", SCRIPT_PARAM_ONKEYDOWN, false, activeCombo)
  58.         MYiConfig:addParam("drawcircles", "Draw Circles", SCRIPT_PARAM_ONOFF, true)
  59.         MYiConfig:addParam("drawtext", "Draw Text", SCRIPT_PARAM_ONOFF, true)
  60.         MYiConfig:addParam("autoignite", "Auto Ignite", SCRIPT_PARAM_ONOFF, true)
  61.         MYiConfig:addParam("autoQ", "Auto Q KS on killable enemy", SCRIPT_PARAM_ONKEYTOGGLE, false, autoRQkey) -- Off by default
  62.         MYiConfig:addParam("autoW", "Auto W Low Health", SCRIPT_PARAM_ONKEYTOGGLE, false, hotWkey) -- Off by default -- Little bugging
  63.         MYiConfig:permaShow("scriptActive")
  64.         MYiConfig:permaShow("autoQ")
  65.         MYiConfig:permaShow("autoW")
  66.         ts = TargetSelector(TARGET_LOW_HP,range+150,DAMAGE_MAGIC,true)
  67.         ts.name = "MasterYi"
  68.         MYiConfig:addTS(ts)
  69.         if myHero:GetSpellData(SUMMONER_1).name:find("SummonerDot") then ignite = SUMMONER_1
  70.         elseif myHero:GetSpellData(SUMMONER_2).name:find("SummonerDot") then ignite = SUMMONER_2 end
  71.         for i=1, heroManager.iCount do waittxt[i] = i*3 end
  72.     end
  73.      
  74.     function OnTick()
  75.         ts:update()
  76.         DFGSlot, HXGSlot, BWCSlot, SheenSlot, TrinitySlot, LichBaneSlot, YomumusGhostbladeSlot = GetInventorySlotItem(3128), GetInventorySlotItem(3146), GetInventorySlotItem(3144), GetInventorySlotItem(3057), GetInventorySlotItem(3078), GetInventorySlotItem(3100), GetInventorySlotItem(3142)
  77.         EXECSlot = GetInventorySlotItem(3123)
  78.         RANOSlot = GetInventorySlotItem(3143)
  79.         BRKSlot = GetInventorySlotItem(3153)
  80.         RavenousHydraSlot = GetInventorySlotItem(3074)
  81.         IcebornSlot, LiandrysSlot, BlackfireSlot = GetInventorySlotItem(3025), GetInventorySlotItem(3151), GetInventorySlotItem(3188)
  82.         --
  83.         QREADY = (myHero:CanUseSpell(_Q) == READY)
  84.         WREADY = (myHero:CanUseSpell(_W) == READY)
  85.         EREADY = (myHero:CanUseSpell(_E) == READY)
  86.         RREADY = (myHero:CanUseSpell(_R) == READY)
  87.         DFGREADY = (DFGSlot ~= nil and myHero:CanUseSpell(DFGSlot) == READY)
  88.         HXGREADY = (HXGSlot ~= nil and myHero:CanUseSpell(HXGSlot) == READY)
  89.         BWCREADY = (BWCSlot ~= nil and myHero:CanUseSpell(BWCSlot) == READY)
  90.         YomumusGhostbladeReady = (YomumusGhostbladeSlot ~= nil and myHero:CanUseSpell(YomumusGhostbladeSlot) == READY)
  91.         EXECReady = (EXECSlot ~= nil and myHero:CanUseSpell(EXECSlot) == READY)
  92.         RANOReady = (RANOSlot ~= nil and myHero:CanUseSpell(RANOSlot) == READY)
  93.         BRKReady = (BRKSlot ~= nil and myHero:CanUseSpell(BRKSlot) == READY)
  94.         RavHydraReady = (RavenousHydraSlot ~= nil and myHero:CanUseSpell(RavenousHydraSlot) == READY)          
  95.         IREADY = (ignite ~= nil and myHero:CanUseSpell(ignite) == READY)
  96.         if tick == nil or GetTickCount()-tick >= 100 then
  97.                 tick = GetTickCount()
  98.                 YiDmgCalculation()
  99.         end
  100.         if MYiConfig.autoQ and ts.target and QREADY then
  101.                 --mana check managament:
  102.                 local SpellDataQ2 = myHero:GetSpellData(_Q)
  103.                 local totalCost2 = 100 + (60+10*SpellDataQ2.level) --total cost of mana necessary to do a R+Q
  104.                 if myHero.mana >= totalCost2 then
  105.                         WeHaveMana2 = true
  106.                 else
  107.                         WeHaveMana2 = false
  108.                 end
  109.                 --end mana check
  110.                 local qdmg = getDmg("Q",ts.target,myHero)
  111.                 if WeHaveMana2 and QREADY and ts.target.health < qdmg then
  112.                         if RREADY and not UltimateActive and GetDistance(ts.target) <= (range-100) then CastSpell(_R) end
  113.                         if GetDistance(ts.target) <= (range-100) then CastSpell(_Q, ts.target) end
  114.                 end
  115.                 if not WeHaveMana2 and QREADY and ts.target.health < qdmg then
  116.                         if GetDistance(ts.target) <= (range-100) then CastSpell(_Q, ts.target) end
  117.                 end            
  118.         end
  119.         if MYiConfig.scriptActive and ts.target then
  120.         --mana check managament:
  121.                 local SpellDataQ = myHero:GetSpellData(_Q)
  122.                 local totalCost = 100 + (60+10*SpellDataQ.level) --total cost of mana necessary to do a R+Q
  123.                 if myHero.mana >= totalCost then
  124.                         WeHaveMana = true
  125.                 else
  126.                         WeHaveMana = false
  127.                 end
  128.         --end mana check
  129.                 if DFGREADY then CastSpell(DFGSlot, ts.target) end
  130.                 if YomumusGhostbladeReady then CastSpell(YomumusGhostbladeSlot, ts.target) end
  131.                 if EXECReady then CastSpell(EXECSlot, ts.target) end
  132.                 if BRKReady then CastSpell(BRKSlot, ts.target) end
  133.                 if RavHydraReady then CastSpell(RavenousHydraSlot, ts.target) end
  134.                 if RANOReady then CastSpell(RANOSlot, ts.target) end                    
  135.                 if HXGREADY then CastSpell(HXGSlot, ts.target) end
  136.                 if BWCREADY then CastSpell(BWCSlot, ts.target) end
  137.                 if WeHaveMana then
  138.                         if RREADY and not UltimateActive then CastSpell(_R) end
  139.                         if QREADY and GetDistance(ts.target) <= range then CastSpell(_Q, ts.target) end
  140.                 else
  141.                         if QREADY and GetDistance(ts.target) <= range then CastSpell(_Q, ts.target) end
  142.                 end
  143.                 if EREADY and not WujuStyleActive then CastSpell(_E) end
  144.                 myHero:Attack(ts.target)
  145.         end
  146.         if MYiConfig.autoignite then  
  147.                 if IREADY then
  148.                         local ignitedmg = 0    
  149.                         for j = 1, heroManager.iCount, 1 do
  150.                                 local enemyhero = heroManager:getHero(j)
  151.                                 if ValidTarget(enemyhero,600) then
  152.                                         ignitedmg = 50 + 20 * myHero.level
  153.                                         if enemyhero.health <= ignitedmg then
  154.                                                 CastSpell(ignite, enemyhero)
  155.                                         end
  156.                                 end
  157.                         end
  158.                 end
  159.         end
  160.         if MYiConfig.autoW then
  161.             if WREADY then
  162.                 if myHero.health < (myHero.maxHealth*healthPer) then
  163.                     CastSpell(_W)
  164.                     player:HoldPosition()
  165.                 end
  166.             end
  167.         end
  168.     end
  169.     function YiDmgCalculation()
  170.             local enemy = heroManager:GetHero(calculationenemy)
  171.             if ValidTarget(enemy) then
  172.                     local dfgdamage, hxgdamage, bwcdamage, ignitedamage, Sheendamage, Trinitydamage, LichBanedamage  = 0, 0, 0, 0, 0, 0, 0
  173.                     local qdamage = getDmg("Q",enemy,myHero)
  174.                     local hitdamage = getDmg("AD",enemy,myHero)
  175.                     local dfgdamage = (DFGSlot and getDmg("DFG",enemy,myHero) or 0)
  176.                     local hxgdamage = (HXGSlot and getDmg("HXG",enemy,myHero) or 0)
  177.                     local bwcdamage = (BWCSlot and getDmg("BWC",enemy,myHero) or 0)
  178.                     local ignitedamage = (ignite and getDmg("IGNITE",enemy,myHero) or 0)
  179.                     local onhitdmg = (SheenSlot and getDmg("SHEEN",enemy,myHero) or 0)+(TrinitySlot and getDmg("TRINITY",enemy,myHero) or 0)+(LichBaneSlot and getDmg("LICHBANE",enemy,myHero) or 0)+(IcebornSlot and getDmg("ICEBORN",enemy,myHero) or 0)
  180.                     local onspelldamage = (LiandrysSlot and getDmg("LIANDRYS",enemy,myHero) or 0)+(BlackfireSlot and getDmg("BLACKFIRE",enemy,myHero) or 0)
  181.                     local combo1 = qdamage*2 + onspelldamage
  182.                     local combo2 = onspelldamage
  183.                     local combo3 = onspelldamage
  184.                     local combo4 = onspelldamage
  185.                     if QREADY then
  186.                             combo2 = combo2 + qdamage*2
  187.                             combo3 = combo3 + qdamage
  188.                             combo4 = combo4 + qdamage
  189.                     end
  190.                     if HXGREADY then              
  191.                             combo1 = combo1 + hxgdamage    
  192.                             combo2 = combo2 + hxgdamage
  193.                             combo3 = combo3 + hxgdamage
  194.                             combo4 = combo4 + hxgdamage
  195.                     end
  196.                     if BWCREADY then
  197.                             combo1 = combo1 + bwcdamage
  198.                             combo2 = combo2 + bwcdamage
  199.                             combo3 = combo3 + bwcdamage
  200.                             combo4 = combo4 + bwcdamage
  201.                     end
  202.                     if DFGREADY then        
  203.                             combo1 = combo1*1.2 + dfgdamage            
  204.                             combo2 = combo2*1.2 + dfgdamage
  205.                             combo3 = combo3*1.2 + dfgdamage
  206.                             combo4 = combo4*1.2 + dfgdamage
  207.                     end                
  208.                     if IREADY and MYiConfig.autoignite then
  209.                             combo1 = combo1 + ignitedamage
  210.                             combo2 = combo2 + ignitedamage
  211.                             combo3 = combo3 + ignitedamage
  212.                             combo4 = combo4 + ignitedamage
  213.                     end
  214.                     combo1 = combo1 + hitdamage*10 + onhitdmg    
  215.                     combo2 = combo2 + hitdamage*10 + onhitdmg
  216.                     combo3 = combo3 + hitdamage*5 + onhitdmg    
  217.                     if combo4 >= enemy.health then killable[calculationenemy] = 4
  218.                     elseif combo3 >= enemy.health then killable[calculationenemy] = 3
  219.                     elseif combo2 >= enemy.health then killable[calculationenemy] = 2
  220.                     elseif combo1 >= enemy.health then killable[calculationenemy] = 1
  221.                     else killable[calculationenemy] = 0 end
  222.             end
  223.             if calculationenemy == 1 then
  224.                     calculationenemy = heroManager.iCount
  225.             else
  226.                     calculationenemy = calculationenemy-1
  227.             end
  228.     end
  229.     function OnDraw()
  230.             if MYiConfig.drawcircles and not myHero.dead then
  231.                     DrawCircle(myHero.x, myHero.y, myHero.z, range, 0x990099)
  232.                     if ts.target ~= nil then
  233.                             for j=0, 10 do
  234.                                     DrawCircle(ts.target.x, ts.target.y, ts.target.z, 40 + j*1.5, 0x00FF00)
  235.                             end
  236.                     end
  237.             end
  238.             for i=1, heroManager.iCount do
  239.                     local enemydraw = heroManager:GetHero(i)
  240.                     if ValidTarget(enemydraw) then
  241.                             if MYiConfig.drawcircles then
  242.                                     if killable[i] == 1 then
  243.                                             for j=0, 20 do
  244.                                                     DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 80 + j*1.5, 0x0000FF)
  245.                                             end
  246.                                     elseif killable[i] == 2 then
  247.                                             for j=0, 10 do
  248.                                                     DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 80 + j*1.5, 0xFF0000)
  249.                                             end
  250.                                     elseif killable[i] == 3 then
  251.                                             for j=0, 10 do
  252.                                                     DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 80 + j*1.5, 0xFF0000)
  253.                                                     DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 110 + j*1.5, 0xFF0000)
  254.                                             end
  255.                                     elseif killable[i] == 4 then
  256.                                             for j=0, 10 do
  257.                                                     DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 80 + j*1.5, 0xFF0000)
  258.                                                     DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 110 + j*1.5, 0xFF0000)
  259.                                                     DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 140 + j*1.5, 0xFF0000)
  260.                                             end
  261.                                     end
  262.                             end
  263.                             if MYiConfig.drawtext and waittxt[i] == 1 and killable[i] ~= 0 then
  264.                                     PrintFloatText(enemydraw,0,floattext[killable[i]])
  265.                             end
  266.                     end
  267.                     if waittxt[i] == 1 then waittxt[i] = 30
  268.                     else waittxt[i] = waittxt[i]-1 end
  269.             end
  270.     end
  271.  
  272.     function OnSendChat(msg)
  273.         ts:OnSendChat(msg, "pri")
  274.     end
  275.    
  276.     function OnCreateObj(object)
  277.         if object.name == "WujustyleSC_buf.troy" then WujuStyleActive = true end
  278.         if object.name == "Highlander_buf.troy" then UltimateActive = true end
  279.     end
  280.  
  281.     function OnDeleteObj(object)
  282.         if object.name == "WujustyleSC_buf.troy" then WujuStyleActive = false end
  283.         if object.name == "Highlander_buf.troy" then UltimateActive = false end
  284.     end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement