Guest User

Untitled

a guest
May 26th, 2018
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.39 KB | None | 0 0
  1. local Invoker = require("Invoker")
  2.  
  3. local LastHit = {}
  4.  
  5. local optionAwareness = Menu.AddOption({"Utility"}, "Last Hit Awareness", "On/Off")
  6. local optionEnable = Menu.AddOption({"Utility"}, "Last Hit Enable", "On/Off")
  7. local key = Menu.AddKeyOption({"Utility"}, "Last Hit Key", Enum.ButtonCode.KEY_SPACE)
  8.  
  9. local target1, target2
  10.  
  11. function LastHit.OnUpdate()
  12. if not Menu.IsEnabled(optionEnable) then return end
  13. if not Menu.IsKeyDown(key) then return end
  14.  
  15. local myHero = Heroes.GetLocal()
  16. if not myHero then return end
  17.  
  18. local range = NPC.GetAttackRange(myHero)
  19. local target
  20.  
  21. if target2 and Entity.IsAlive(target2) and not Entity.IsDormant(target2) and NPC.IsEntityInRange(myHero, target2, range) then target = target2 end
  22. if target1 and Entity.IsAlive(target1) and not Entity.IsDormant(target1) and NPC.IsEntityInRange(myHero, target1, range) then target = target1 end
  23.  
  24. if NPC.GetUnitName(myHero) == "npc_dota_hero_invoker" then Invoker.PressKey(myHero, "EEE") end
  25.  
  26. if target then Player.AttackTarget(Players.GetLocal(), myHero, target) end
  27. end
  28.  
  29. function LastHit.OnDraw()
  30. if not Menu.IsEnabled(optionAwareness) then return end
  31.  
  32. local myHero = Heroes.GetLocal()
  33. if not myHero then return end
  34. if not NPC.IsVisible(myHero) then return end
  35.  
  36. local radius = 1000
  37. local creeps = NPC.GetUnitsInRadius(myHero, radius, Enum.TeamType.TEAM_ENEMY)
  38. for i, npc in ipairs(creeps) do
  39. local oneHitDamage = LastHit.GetOneHitDamageVersus(myHero, npc)
  40. if NPC.IsCreep(npc) and Entity.IsAlive(npc) and not Entity.IsDormant(npc) then
  41.  
  42. local x, y, visible = Renderer.WorldToScreen(Entity.GetAbsOrigin(npc))
  43. local size = 10
  44.  
  45. if Entity.GetHealth(npc) <= oneHitDamage then
  46. Renderer.SetDrawColor(255, 0, 0, 150)
  47. Renderer.DrawFilledRect(x-size, y-size, 2*size, 2*size)
  48. target1 = npc
  49. elseif Entity.GetHealth(npc) <= 1.5 * oneHitDamage then
  50. Renderer.SetDrawColor(255, 255, 0, 150)
  51. Renderer.DrawFilledRect(x-size, y-size, 2*size, 2*size)
  52. target2 = npc
  53. end
  54. end
  55. end
  56. end
  57.  
  58. function LastHit.GetOneHitDamageVersus(myHero, npc)
  59. if not myHero or not npc then return 0 end
  60.  
  61. local damage = NPC.GetTrueDamage(myHero) * NPC.GetArmorDamageMultiplier(npc)
  62.  
  63. if NPC.GetUnitName(myHero) == "npc_dota_hero_invoker" and Invoker.GetInstances(myHero) ~= "EEE" then
  64. local E = NPC.GetAbility(myHero, "invoker_exort")
  65. local extra_damage = 12 * Ability.GetLevel(E)
  66. damage = damage + extra_damage
  67. end
  68.  
  69. return damage
  70. end
  71.  
  72. return LastHit
Add Comment
Please, Sign In to add comment