-
Notifications
You must be signed in to change notification settings - Fork 23
/
Rapier.lua
79 lines (71 loc) · 3.6 KB
/
Rapier.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
local rapier= {}
rapier.optionEnable = Menu.AddOption({ "Utility", "Rapier"}, "Enable", "Using Rapier without losing it")
rapier.optionKey = Menu.AddKeyOption({ "Utility","Rapier"}, "Key", Enum.ButtonCode.KEY_P)
--rapier.fontSize = Menu.AddOption({ "Awareness", "Show rapier Count"}, "Font Size", "", 20, 50, 10)
rapier.font = Renderer.LoadFont("Tahoma", 30, Enum.FontWeight.EXTRABOLD)
rapier.nextTick = 0
rapier.isChanneling = false
rapier.sniperTickStart = 0
rapier.sniperTickEnd = 0
rapier.sniperTickMid = 0
function rapier.OnUpdate()
if not Menu.IsEnabled(rapier.optionEnable) then return end
local myHero = Heroes.GetLocal()
if myHero == nill then return end
local rapierItem = NPC.GetItem(myHero,"item_rapier",false)
if rapierItem and not NPC.IsAttacking(myHero) and os.clock() > rapier.nextTick and not rapier.isChanneling then
Player.PrepareUnitOrders(Players.GetLocal(), Enum.UnitOrder.DOTA_UNIT_ORDER_DISASSEMBLE_ITEM, rapierItem, Vector(0,0,0), rapierItem, Enum.PlayerOrderIssuer.DOTA_ORDER_ISSUER_PASSED_UNIT_ONLY, rapierItem)
end
local snip = NPC.GetAbility(myHero,"sniper_assassinate")
if rapier.sniperTickMid<os.clock() and rapier.sniperTickEnd>os.clock() then
local ghost = NPC.GetItem(myHero, "item_ghost")
if ghost and Ability.IsReady(ghost, 0)then
Ability.CastNoTarget(ghost)
return
end
local myMana = NPC.GetMana(myHero)
local eul = NPC.GetItem(myHero, "item_cyclone")
if eul and NPC.GetMana(myHero) then
Ability.CastTarget(eul, myHero)
end
return
end
if rapier.sniperTickStart<os.clock() and rapier.sniperTickEnd>os.clock() then
Player.PrepareUnitOrders(Players.GetLocal(), Enum.UnitOrder.DOTA_UNIT_ORDER_CAST_POSITION, snip, Input.GetWorldCursorPos(), snip, Enum.PlayerOrderIssuer.DOTA_ORDER_ISSUER_PASSED_UNIT_ONLY, snip)
return
end
if rapier.sniperTickEnd< os.clock() then
rapier.isChanneling = false
end
if not Menu.IsKeyDown(rapier.optionKey) then return end
local target = Input.GetNearestHeroToCursor(Entity.GetTeamNum(myHero), Enum.TeamType.TEAM_ENEMY)
if target == nill then return end
rapier.combine(myHero)
Player.PrepareUnitOrders(Players.GetLocal(), 4, target, Vector(0,0,0), target, Enum.PlayerOrderIssuer.DOTA_ORDER_ISSUER_PASSED_UNIT_ONLY, myHero)
end
function rapier.OnPrepareUnitOrders(orders)
if not Menu.IsEnabled(rapier.optionEnable) then return true end
local myHero = Heroes.GetLocal()
if orders.order == 5 and Ability.GetName(orders.ability) == "sniper_assassinate" then
rapier.isChanneling = true
rapier.combine(myHero)
rapier.sniperTickStart = os.clock()+0.01
rapier.sniperTickMid = os.clock() + 2.02
rapier.sniperTickEnd = os.clock()+ 3.5
return false
end
if orders.order ~= 4 and orders.order ~=3 then return true end
rapier.combine(myHero)
return true
end
function rapier.combine(myHero)
local blade = NPC.GetItem(myHero,"item_demon_edge",false)
local relic = NPC.GetItem(myHero,"item_relic",false)
if Entity.GetHealth(myHero)/Entity.GetMaxHealth(myHero) < 0.2 then return end
if blade and relic and not NPC.IsAttacking(myHero) then
Player.PrepareUnitOrders(Players.GetLocal(), 32, blade, Vector(0,0,0), blade, Enum.PlayerOrderIssuer.DOTA_ORDER_ISSUER_PASSED_UNIT_ONLY, blade)
Player.PrepareUnitOrders(Players.GetLocal(), 32, relic, Vector(0,0,0), relic, Enum.PlayerOrderIssuer.DOTA_ORDER_ISSUER_PASSED_UNIT_ONLY, relic)
rapier.nextTick = os.clock() + NPC.GetAttackTime(myHero)/2
end
end
return rapier