Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require "Utils"
- require 'SKeys'
- require "spell_damage"
- local uiconfig = require 'uiconfig'
- local targetignite
- local target
- local PassiveStun=0
- local _registry = {}
- Annie, menu = uiconfig.add_menu('Annie',200)
- menu.keydown('Combo','Combo', Keys.X)
- menu.keytoggle('ComboR', 'R in Combo', Keys.Z, false)
- menu.keydown('Farm','Farm', Keys.C)
- menu.checkbutton('autoignite', 'Ignite-ks',true)
- menu.checkbutton('Killsteal','Killsteal',true)
- menu.checkbutton('useAutoMECR', 'use Auto MEC R', true)
- menu.slider('valMECR', 'Minimum MEC Value', 1, 5, 3, {1,2,3,4,5})
- menu.checkbutton('AutoZonyas', 'AutoZonyas', true)
- menu.slider('Zhonyas_Hourglass_Value', 'Zhonya Hourglass Value', 0, 100, 15, nil, true)
- function Main()
- GetCD()
- Items()
- ignite()
- StunEvolution()
- target = GetBestEnemy("MAGIC", 625, "NEARMOUSE")
- if target==nil then
- target = GetWeakEnemy("MAGIC", 625)
- end
- targetignite = GetBestEnemy('TRUE',600)
- if Annie.Combo then Combo() end
- if Annie.Farm then Farm() end
- if Annie.Killsteal then Killsteal() end
- if Annie.autoignite then ignite() end
- if Annie.useAutoMECR then mecStunULT(Annie.valMECR) end
- end
- function Combo()
- for i = 1, objManager:GetMaxHeroes() do
- local hero = objManager:GetHero(i)
- if target~= nil and CountEnemyHeroInRange(625, myHero)>2 then
- if GetDistance(myHero,target) <600 and WRDY==1 and StunCheck() then
- CastSpellTarget('W',target)
- elseif GetDistance(myHero,target) <625 and WRDY==1 and not runningAway(target) and StunCheck() then
- CastSpellTarget('W',target)
- elseif GetDistance(myHero,target) <625 and QRDY==1 and not StunCheck() then
- CastSpellTarget('Q',target)
- end
- if GetDistance(myHero,target) <600 and Annie.ComboR and RRDY==1 and StunCheck() then
- CastSpellTarget('R',target)
- elseif GetDistance(myHero,target) <600 and Annie.ComboR and RRDY==1 and target.health<target.health*0.50 then
- CastSpellTarget('R',target)
- end
- if PassiveStun==1 and QRDY==1 and ERDY==1 and GetDistance(myHero,target)<620 then
- CastSpellTarget('Q',target)
- CastSpellTarget('E',myHero)
- end
- if PassiveStun==2 and QRDY==1 and GetDistance(myHero,target)<620 then
- CastSpellTarget('Q',target)
- end
- if PassiveStun==3 and QRDY==1 and GetDistance(myHero,target)<620 then
- CastSpellTarget('Q',target)
- end
- if StunCheck() and WRDY==1 and QRDY==0 and RRDY==0 and GetDistance(myHero,target)<600 then
- CastSpellTarget('W',target)
- elseif StunCheck() and RRDY==1 and GetDistance(myHero,target)<600 then
- CastSpellTarget('R',target)
- end
- if ERDY==1 and GetDistance(myHero,target)<=500 then
- CastSpellTarget('E',myHero)
- if PassiveStun==1 and WRDY==1 and GetDistance(myHero,target)<600 then
- CastSpellTarget('W',target)
- end
- if PassiveStun==2 and WRDY==1 and GetDistance(myHero,target)<600 then
- CastSpellTarget('W',target)
- end
- if PassiveStun==3 and WRDY==1 and GetDistance(myHero,target)<600 then
- CastSpellTarget('W',target)
- elseif StunCheck() and QRDY==1 and WRDY==0 then
- CastSpellTarget('Q',target)
- elseif StunCheck() and WRDY==1 and QRDY==0 then
- CastSpellTarget('W',target)
- else
- CastSpellTarget('W',target)
- CastSpellTarget('E',myHero)
- end
- if GetDistance(myHero,target)<400 then
- UseAllItems(target)
- end
- if QRDY==1 and GetDistance(myHero,target)<600 then
- CastSpellTarget('Q',target)
- end
- if ERDY==1 and GetDistance(myHero,target)<=500 then
- CastSpellTarget('E',myHero)
- elseif myHero.health<=myHero.health*0.2 and ERDY==1 then
- CastSpellTarget('E',myHero)
- end
- end
- if target~= nil and CountEnemyHeroInRange(625, myHero)<=2 then
- if GetDistance(myHero,target)<625 then
- if PassiveStun==1 and WRDY==1 and GetDistance(myHero,target)<600 then
- CastSpellTarget('W',target)
- end
- if PassiveStun==2 and WRDY==1 and GetDistance(myHero,target)<600 then
- CastSpellTarget('W',target)
- end
- if PassiveStun==3 and WRDY==1 and GetDistance(myHero,target)<600 then
- CastSpellTarget('W',target)
- elseif StunCheck() and QRDY==1 and WRDY==0 then
- CastSpellTarget('Q',target)
- CastSpellTarget('W',target)
- end
- if PassiveStun==1 and QRDY==1 then
- CastSpellTarget('Q',target)
- end
- if PassiveStun==2 and QRDY==1 then
- CastSpellTarget('Q',target)
- end
- elseif PassiveStun==3 and QRDY==1 then
- CastSpellTarget('Q',target)
- elseif StunCheck() and RRDY==1 and not runningAway(hero) and QRDY==0 then
- CastSpellTarget('R',target)
- else
- CastSpellTarget('W',target)
- CastSpellTarget('E',myHero)
- end
- if PassiveStun==1 and ERDY==1 then
- CastSpellTarget('E',myHero)
- if PassiveStun==2 and ERDY==1 then
- CastSpellTarget('E',myHero)
- if PassiveStun==3 and ERDY==1 then
- CastSpellTarget('E',myHero)
- end
- if RRDY==1 and Annie.ComboR and target.health<target.health*0.50 and StunCheck() then
- CastSpellTarget('R',target)
- end
- if PassiveStun==3 and RRDY==1 and Annie.ComboR then
- CastSpellTarget('R',target)
- if StunCheck() and RRDY==0 then
- CastSpellTarget('Q',target)
- UseAllItems(target)
- end
- end
- UseAllItems(target)
- end
- end
- end
- end
- end
- end
- function Items()
- if Annie.AutoZonyas and myHero.health < myHero.maxHealth*(Annie.Zhonyas_Hourglass_Value/100) then
- UseItemOnTarget(3157,myHero)
- UseItemOnTarget(3090,myHero)
- end
- end
- function runningAway(slowtarget)
- local d1 = GetD(slowtarget)
- local x, y, z = GetFireahead(slowtarget,2,0)
- local d2 = GetD({x=x, y=y, z=z})
- local d3 = GetD({x=x, y=y, z=z},slowtarget)
- local angle = math.acos((d2*d2-d3*d3-d1*d1)/(-2*d3*d1))
- return angle%(2*math.pi)>math.pi/2 and angle%(2*math.pi)<math.pi*3/2
- end
- function GetD(p1, p2)
- if p2 == nil then p2 = myHero end
- 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
- px=p1.x-p2.x
- py=p1.y-p2.y
- if px~=nil and py~=nil then
- px2=px*px
- py2=py*py
- if px2~=nil and py2~=nil then
- return math.sqrt(px2+py2)
- else
- return 99999
- end
- else
- return 99999
- end
- elseif p1.x~=nil and p1.z ~=nil and p2.x~=nil and p2.z~=nil then
- px=p1.x-p2.x
- pz=p1.z-p2.z
- if px~=nil and pz~=nil then
- px2=px*px
- pz2=pz*pz
- if px2~=nil and pz2~=nil then
- return math.sqrt(px2+pz2)
- else
- return 99999
- end
- else
- return 99999
- end
- else
- return 99999
- end
- end
- function Killsteal()
- if GetInventorySlot(3001)~=nil then TrueMG = 1
- else TrueMG = 0 end
- for i = 1, objManager:GetMaxHeroes() do
- local enemy = objManager:GetHero(i)
- if enemy~=nil and enemy.team~=myHero.team and enemy.visible==1 and enemy.invulnerable==0 and enemy.dead==0 then
- local xQ = (45+(myHero.SpellLevelQ*35)+(myHero.ap*.80))*QRDY
- local xW = (25+(myHero.SpellLevelW*45)+(myHero.ap*.85))*WRDY
- local xR = (50+(myHero.SpellLevelR*125)+(myHero.ap*.80))*RRDY
- local effh = (enemy.health)*(1+((((enemy.magicArmor-(20*TrueMG))*myHero.magicPenPercent)-myHero.magicPen)/100))
- local ignitedamage = (myHero.selflevel*20)+50
- if effh<xQ and GetDistance(myHero,enemy)<625 then
- CastSpellTarget('Q', enemy)
- end
- if effh<xW and GetDistance(myHero,enemy)<625 then
- CastSpellTarget('W',enemy)
- end
- if effh<xR and GetDistance(myHero,enemy)<600 then
- CastSpellTarget('R',enemy)
- end
- if effh<xQ+xW and StunCheck() and GetDistance(myHero,enemy)<625 then
- CastSpellTarget('Q', enemy)
- CastSpellTarget('W',enemy)
- CastIgnite(enemy)
- end
- if effh<xQ+xW+ignitedamage and GetDistance(myHero,enemy)<600 then
- CastSpellTarget('W',enemy)
- CastIgnite(enemy)
- CastSpellTarget('Q', enemy)
- end
- if effh<xQ+xR and GetDistance(myHero,enemy)<600 then
- CastSpellTarget('R',enemy)
- CastIgnite(enemy)
- CastSpellTarget('Q', enemy)
- end
- end
- end
- end
- function ignite()
- local damage = (myHero.selflevel*20)+50
- if targetignite ~= nil then
- if myHero.SummonerD == "SummonerDot" then
- if targetignite.health < damage then
- CastSpellTarget("D",targetignite)
- end
- end
- if myHero.SummonerF == "SummonerDot" then
- if targetignite.health < damage then
- CastSpellTarget("F",targetignite)
- end
- end
- end
- end
- function CastIgnite(enemy)
- for i = 1, objManager:GetMaxHeroes() do
- local enemy = objManager:GetHero(i)
- if enemy~=nil and enemy.team~=myHero.team and enemy.visible==1 and enemy.invulnerable==0 and enemy.dead==0 then
- if myHero.SummonerD == "SummonerDot" then
- CastSpellTarget("D",enemy)
- end
- if myHero.SummonerF == "SummonerDot" then
- CastSpellTarget("F",enemy)
- end
- end
- end
- end
- function Farm()
- local myQ = math.floor(((GetSpellLevel("Q")-1)*40) + 85 + (myHero.ap * .8))
- local minion = GetLowestHealthEnemyMinion(600)
- if minion then
- DrawCircle(minion.x, minion.y, minion.z, 100, Color.Red) end
- if minion ~= nil and minion.health <= CalcMagicDamage(minion, myQ) then
- CastSpellTarget("Q", minion)
- end
- end
- local StatusReturn={}
- function getStatus(target)
- StatusReturn=nil
- for i=1, objManager:GetMaxObjects(), 1 do
- local object = objManager:GetObject(i)
- if object ~= nil then
- if string.find(object.charName,"eyeforaneye") ~= nil and GetDistance(target,object) <= 20 then return {status = 1, name = 'Intervention', amount = 0, type = 'ALL'}
- elseif string.find(object.charName,"nickoftime") ~= nil and GetDistance(target,object) <= 20 then return {status = 4, name = 'Chrono Shift', amount = 0, type = 'REVIVE'}
- elseif target.name == 'Poppy' and string.find(object.charName,"DiplomaticImmunity_tar") ~= nil and GetDistance(myHero,object) > 20 then
- for i=1, objManager:GetMaxObjects(), 1 do
- local diObject = objManager:GetObject(i)
- if diObject ~= nil and string.find(diObject.charName,"DiplomaticImmunity_buf") ~= nil and GetDistance(target,diObject) <= 20 then return {status = 1, name = 'Diplomatic Immunity', amount = 0, type = 'ALL'} end
- end
- elseif target.name == 'Vladimir' and string.find(object.charName,"VladSanguinePool_buf") ~= nil and GetDistance(myHero,object) <= 20 then return {status = 1, name = 'Sanguine Pool', amount = 0, type = 'ALL'}
- -- elseif string.find(object.charName,"Summoner_Barrier") ~= nil and GetDistance(target,object) <= 20 then return 2--, 'NONE'
- elseif (string.find(object.charName,"Global_Spellimmunity") ~= nil or string.find(object.charName,"Morgana_Blackthorn_Blackshield") ~= nil) and GetDistance(target,object) <= 20 then
- local amount = 0
- for i= 1,objManager:GetMaxHeroes(),1 do
- local hero=objManager:GetHero(i)
- if hero.team == target.team and hero.name == 'Morgana' then
- amount = 30+(65*hero.SpellLevelE)+(hero.ap*0.7)
- return {status = 2, name = 'Black Shield', amount = amount, type = 'MAGIC'}
- end
- end
- elseif string.find(object.charName,"bansheesveil_buf") ~= nil and GetDistance(target,object) <= 20 then return {status = 2, name = 'Banshees Veil', amount = 0, type = 'SPELL'}
- elseif target.name == 'Sivir' and string.find(object.charName,"Sivir_Base_E_shield") ~= nil and GetDistance(target,object) <= 20 then return {status = 2, name = 'Spell Shield', amount = 0, type = 'SPELL'}
- elseif target.name == 'Nocturne' and string.find(object.charName,"nocturne_shroudofDarkness_shield") ~= nil and GetDistance(target,object) <= 20 then return {status = 2, name = 'Shroud of Darkness', amount = 0, type = 'SPELL'}
- elseif target.name == 'Tryndamere' and string.find(object.charName,"UndyingRage_buf") ~= nil and GetDistance(target,object) <= 20 then return {status = 4, name = 'Undying Rage', amount = 0, type = 'NONE'}
- elseif string.find(object.charName,"rebirthready") ~= nil and GetDistance(target,object) <= 20 then return {status = 3, name = 'Guardian Angel', amount = 0, type = 'REVIVE'}
- -- elseif string.find(object.charName,"GLOBAL_Item_FoM_Shield") ~= nil and GetDistance(target,object) <= 30 then return 2--, 'NONE'
- -- elseif target.name == 'Nautilus' and string.find(object.charName,"Nautilus_W_shield_cas") ~= nil and GetDistance(target,object) <= 20 then return 2--, 'NONE'
- end
- end
- end
- end
- function IsInvulnerable(target)
- if target ~= nil and target.dead == 0 then
- if target.invulnerable == 1 then return {status = 1, name = nil, amount = nil, type = nil}
- else
- StatusReturn=run_every(0.3,getStatus,target)
- if StatusReturn~=nil then
- return StatusReturn
- end
- end
- end
- return {status = 0, name = nil, amount = nil, type = nil}
- end
- function run_every(interval, fn, ...)
- return internal_run({fn=fn, interval=interval}, ...)
- end
- function internal_run(t, ...)
- local fn = t.fn
- local key = t.key or fn
- local now = os.clock()
- local data = _registry[key]
- if data == nil or t.reset then
- local args = {}
- local n = select('#', ...)
- local v
- for i=1,n do
- v = select(i, ...)
- table.insert(args, v)
- end
- -- the first t and args are stored in registry
- data = {count=0, last=0, complete=false, t=t, args=args}
- _registry[key] = data
- end
- --assert(data~=nil, 'data==nil')
- --assert(data.count~=nil, 'data.count==nil')
- --assert(now~=nil, 'now==nil')
- --assert(data.t~=nil, 'data.t==nil')
- --assert(data.t.start~=nil, 'data.t.start==nil')
- --assert(data.last~=nil, 'data.last==nil')
- -- run
- local countCheck = (t.count==nil or data.count < t.count)
- local startCheck = (data.t.start==nil or now >= data.t.start)
- local intervalCheck = (t.interval==nil or now-data.last >= t.interval)
- --print('', 'countCheck', tostring(countCheck))
- --print('', 'startCheck', tostring(startCheck))
- --print('', 'intervalCheck', tostring(intervalCheck))
- --print('')
- if not data.complete and countCheck and startCheck and intervalCheck then
- if t.count ~= nil then -- only increment count if count matters
- data.count = data.count + 1
- end
- data.last = now
- if t._while==nil and t._until==nil then
- return fn(...)
- else
- -- while/until handling
- local signal = t._until ~= nil
- local checker = t._while or t._until
- local result
- if fn == checker then
- result = fn(...)
- if result == signal then
- data.complete = true
- end
- return result
- else
- result = checker(...)
- if result == signal then
- data.complete = true
- else
- return fn(...)
- end
- end
- end
- end
- end
- function GetTeamSize()
- return math.floor(objManager:GetMaxHeroes()/2)
- end
- function GetBestEnemy(damage_type, range, tag)
- if tag == nil then tag = "BASIC" end
- local QDMG=0
- local WDMG=0
- local EDMG=0
- local RDMG=0
- local ADMG=0
- local enemy, prospect
- for i=1,GetTeamSize() do
- prospect = GetWeakEnemy(damage_type, range, tag, i)
- if prospect == nil then
- -- pass
- else
- if spellDmg[myHero.name] then
- if QRDY==1 and getDmg("Q",prospect,myHero)~=nil then
- QDMG=getDmg("Q",prospect,myHero)
- else
- QDMG=0
- end
- if WRDY==1 and getDmg("W",prospect,myHero)~=nil then
- WDMG=getDmg("W",prospect,myHero)
- else
- WDMG=0
- end
- if ERDY==1 and getDmg("E",prospect,myHero)~=nil then
- EDMG=getDmg("E",prospect,myHero)
- else
- EDMG=0
- end
- if RRDY==1 and getDmg("R",prospect,myHero)~=nil then
- RDMG=getDmg("R",prospect,myHero)
- else
- RDMG=0
- end
- if getDmg("AD",prospect,myHero)~=nil then
- ADMG=getDmg("AD",prospect,myHero)
- else
- ADMG=0
- end
- end
- local invul=IsInvulnerable(prospect).status
- if invul==1 or (invul==4 and QDMG+WDMG+EDMG+RDMG+ADMG>prospect.health) then
- local msg = "*** target invulnerable, cycling ***"
- print(msg)
- DrawTextObject(msg,myHero,0xFFFF0000)
- else
- enemy = prospect
- break -- <-------- *** important ***
- end
- end
- end
- -- we should return nil if everyone is invuln, same as the original api when no enemies are in range
- --if target == nil then
- -- target = GetWeakEnemy(damage_type, range, tag)
- --end
- return enemy
- end
- function mecStunULT(Value)
- for i = 1, objManager:GetMaxHeroes() do
- local enemy = objManager:GetHero(i)
- if (enemy ~= nil and enemy.team ~= myHero.team and enemy.visible == 1 and enemy.invulnerable == 0 and enemy.dead == 0) then
- ultPos = GetMEC(400, 615, enemy)
- if ultPos and GetDistance(ultPos) < 615 and CountUnit(ultPos,230) >= Value then
- if myHero.SpellLevelR >= 1 and RRDY==1 and myHero.mana >= 100 then
- CastSpellXYZ('R', ultPos.x, 0, ultPos.z)
- end
- end
- end
- end
- end
- function StunCheck()
- for i = 1, objManager:GetMaxObjects(), 1 do
- obj = objManager:GetObject(i)
- if obj~=nil and target~=nil then
- if (obj.charName:find("StunReady")) and GetDistance(obj, myHero) < 100 then
- return true
- end
- end
- end
- end
- function StunEvolution()
- if myHero.name =="Annie" and myHero.dead ==0 then
- if StunCheck() then
- PassiveStun=0
- if QRDY==0 then
- PassiveStun=PassiveStun+1
- end
- if WRDY==0 then
- PassiveStun=PassiveStun+1
- end
- if ERDY==0 then
- PassiveStun=PassiveStun+1
- end
- if RRDY==0 then
- PassiveStun=PassiveStun+1
- end
- end
- end
- end
- function CountUnit(Center,Radius)
- local UnitCount = 0
- for i = 1, objManager:GetMaxHeroes() do
- local enemy = objManager:GetHero(i)
- if (enemy ~= nil and enemy.team ~= myHero.team and enemy.visible == 1 and enemy.invulnerable == 0 and enemy.dead == 0) then
- if GetDistance(enemy,Center) < Radius then
- UnitCount = UnitCount + 1
- end
- end
- end
- return UnitCount
- end
- function CountEnemyHeroInRange(range, object)
- object = object or myHero
- range = range and range * range or myHero.range * myHero.range
- local enemyInRange = 0
- for i = 1, objManager:GetMaxHeroes() do
- local hero = objManager:GetHero(i)
- if (hero~=nil and hero.team~=myHero.team and hero.dead==0) and GetD(object, hero) <= range then
- enemyInRange = enemyInRange + 1
- end
- end
- return enemyInRange
- end
- function GetCD()
- if myHero.SpellTimeQ > 1 and GetSpellLevel('Q') > 0 then
- QRDY = 1
- else QRDY = 0
- end
- if myHero.SpellTimeW > 1 and GetSpellLevel('W') > 0 then
- WRDY = 1
- else WRDY = 0
- end
- if myHero.SpellTimeE > 1 and GetSpellLevel('E') > 0 then
- ERDY = 1
- else ERDY = 0
- end
- if myHero.SpellTimeR > 1 and GetSpellLevel('R') > 0 then
- RRDY = 1
- else RRDY = 0 end
- end
- SetTimerCallback("Main")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement