Guest User

Untitled

a guest
Feb 26th, 2014
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 116.62 KB | None | 0 0
  1. require "old2dgeo"
  2.  
  3. class 'CollisionPE'
  4. HERO_ALL = 1
  5. HERO_ENEMY = 2
  6. HERO_ALLY = 3
  7.  
  8.  
  9. function CollisionPE:__init(sRange, projSpeed, sDelay, sWidth)
  10. uniqueId = uniqueId + 1
  11. self.uniqueId = uniqueId
  12.  
  13. self.sRange = sRange
  14. self.projSpeed = projSpeed
  15. self.sDelay = sDelay
  16. self.sWidth = sWidth/2
  17.  
  18. self.enemyMinions = minionManager(MINION_ALLY, 2000, myHero, MINION_SORT_HEALTH_ASC)
  19. self.minionupdate = 0
  20. end
  21.  
  22. function CollisionPE:GetMinionCollision(pStart, pEnd)
  23. self.enemyMinions:update()
  24.  
  25. local distance = GetDistance(pStart, pEnd)
  26. local prediction = TargetPredictionVIP(self.sRange, self.projSpeed, self.sDelay, self.sWidth)
  27. local mCollision = {}
  28.  
  29. if distance > self.sRange then
  30. distance = self.sRange
  31. end
  32.  
  33. local V = Vector(pEnd) - Vector(pStart)
  34. local k = V:normalized()
  35. local P = V:perpendicular2():normalized()
  36.  
  37. local t,i,u = k:unpack()
  38. local x,y,z = P:unpack()
  39.  
  40. local startLeftX = pStart.x + (x *self.sWidth)
  41. local startLeftY = pStart.y + (y *self.sWidth)
  42. local startLeftZ = pStart.z + (z *self.sWidth)
  43. local endLeftX = pStart.x + (x * self.sWidth) + (t * distance)
  44. local endLeftY = pStart.y + (y * self.sWidth) + (i * distance)
  45. local endLeftZ = pStart.z + (z * self.sWidth) + (u * distance)
  46.  
  47. local startRightX = pStart.x - (x * self.sWidth)
  48. local startRightY = pStart.y - (y * self.sWidth)
  49. local startRightZ = pStart.z - (z * self.sWidth)
  50. local endRightX = pStart.x - (x * self.sWidth) + (t * distance)
  51. local endRightY = pStart.y - (y * self.sWidth) + (i * distance)
  52. local endRightZ = pStart.z - (z * self.sWidth)+ (u * distance)
  53.  
  54. local startLeft = WorldToScreen(D3DXVECTOR3(startLeftX, startLeftY, startLeftZ))
  55. local endLeft = WorldToScreen(D3DXVECTOR3(endLeftX, endLeftY, endLeftZ))
  56. local startRight = WorldToScreen(D3DXVECTOR3(startRightX, startRightY, startRightZ))
  57. local endRight = WorldToScreen(D3DXVECTOR3(endRightX, endRightY, endRightZ))
  58.  
  59. local poly = Polygon(Point(startLeft.x, startLeft.y), Point(endLeft.x, endLeft.y), Point(startRight.x, startRight.y), Point(endRight.x, endRight.y))
  60.  
  61. for index, minion in pairs(self.enemyMinions.objects) do
  62. if minion ~= nil and minion.valid and not minion.dead then
  63. if GetDistance(pStart, minion) < distance then
  64. local pos, t, vec = prediction:GetPrediction(minion)
  65. local lineSegmentLeft = LineSegment(Point(startLeftX,startLeftZ), Point(endLeftX, endLeftZ))
  66. local lineSegmentRight = LineSegment(Point(startRightX,startRightZ), Point(endRightX, endRightZ))
  67. local toScreen, toPoint
  68. if pos ~= nil then
  69. toScreen = WorldToScreen(D3DXVECTOR3(minion.x, minion.y, minion.z))
  70. toPoint = Point(toScreen.x, toScreen.y)
  71. else
  72. toScreen = WorldToScreen(D3DXVECTOR3(minion.x, minion.y, minion.z))
  73. toPoint = Point(toScreen.x, toScreen.y)
  74. end
  75.  
  76.  
  77. if poly:contains(toPoint) then
  78. table.insert(mCollision, minion)
  79. else
  80. if pos ~= nil then
  81. distance1 = Point(pos.x, pos.z):distance(lineSegmentLeft)
  82. distance2 = Point(pos.x, pos.z):distance(lineSegmentRight)
  83. else
  84. distance1 = Point(minion.x, minion.z):distance(lineSegmentLeft)
  85. distance2 = Point(minion.x, minion.z):distance(lineSegmentRight)
  86. end
  87. if (distance1 < (getHitBoxRadius(minion)*2+10) or distance2 < (getHitBoxRadius(minion) *2+10)) then
  88. table.insert(mCollision, minion)
  89. end
  90. end
  91. end
  92. end
  93. end
  94. if #mCollision > 0 then return true, mCollision else return false, mCollision end
  95. end
  96.  
  97. function CollisionPE:GetHeroCollision(pStart, pEnd, mode)
  98. if mode == nil then mode = HERO_ENEMY end
  99. local heros = {}
  100.  
  101. for i = 1, heroManager.iCount do
  102. local hero = heroManager:GetHero(i)
  103. if (mode == HERO_ENEMY or mode == HERO_ALL) and hero.team ~= myHero.team then
  104. table.insert(heros, hero)
  105. elseif (mode == HERO_ALLY or mode == HERO_ALL) and hero.team == myHero.team and not hero.isMe then
  106. table.insert(heros, hero)
  107. end
  108. end
  109.  
  110. local distance = GetDistance(pStart, pEnd)
  111. local prediction = TargetPredictionVIP(self.sRange, self.projSpeed, self.sDelay, self.sWidth)
  112. local hCollision = {}
  113.  
  114. if distance > self.sRange then
  115. distance = self.sRange
  116. end
  117.  
  118. local V = Vector(pEnd) - Vector(pStart)
  119. local k = V:normalized()
  120. local P = V:perpendicular2():normalized()
  121.  
  122. local t,i,u = k:unpack()
  123. local x,y,z = P:unpack()
  124.  
  125. local startLeftX = pStart.x + (x *self.sWidth)
  126. local startLeftY = pStart.y + (y *self.sWidth)
  127. local startLeftZ = pStart.z + (z *self.sWidth)
  128. local endLeftX = pStart.x + (x * self.sWidth) + (t * distance)
  129. local endLeftY = pStart.y + (y * self.sWidth) + (i * distance)
  130. local endLeftZ = pStart.z + (z * self.sWidth) + (u * distance)
  131.  
  132. local startRightX = pStart.x - (x * self.sWidth)
  133. local startRightY = pStart.y - (y * self.sWidth)
  134. local startRightZ = pStart.z - (z * self.sWidth)
  135. local endRightX = pStart.x - (x * self.sWidth) + (t * distance)
  136. local endRightY = pStart.y - (y * self.sWidth) + (i * distance)
  137. local endRightZ = pStart.z - (z * self.sWidth)+ (u * distance)
  138.  
  139. local startLeft = WorldToScreen(D3DXVECTOR3(startLeftX, startLeftY, startLeftZ))
  140. local endLeft = WorldToScreen(D3DXVECTOR3(endLeftX, endLeftY, endLeftZ))
  141. local startRight = WorldToScreen(D3DXVECTOR3(startRightX, startRightY, startRightZ))
  142. local endRight = WorldToScreen(D3DXVECTOR3(endRightX, endRightY, endRightZ))
  143.  
  144. local poly = Polygon(Point(startLeft.x, startLeft.y), Point(endLeft.x, endLeft.y), Point(startRight.x, startRight.y), Point(endRight.x, endRight.y))
  145.  
  146. for index, hero in pairs(heros) do
  147. if hero ~= nil and hero.valid and not hero.dead then
  148. if GetDistance(pStart, hero) < distance then
  149. local pos, t, vec = prediction:GetPrediction(hero)
  150. local lineSegmentLeft = LineSegment(Point(startLeftX,startLeftZ), Point(endLeftX, endLeftZ))
  151. local lineSegmentRight = LineSegment(Point(startRightX,startRightZ), Point(endRightX, endRightZ))
  152. local toScreen, toPoint
  153. if pos ~= nil then
  154. toScreen = WorldToScreen(D3DXVECTOR3(pos.x, hero.y, pos.z))
  155. toPoint = Point(toScreen.x, toScreen.y)
  156. else
  157. toScreen = WorldToScreen(D3DXVECTOR3(hero.x, hero.y, hero.z))
  158. toPoint = Point(toScreen.x, toScreen.y)
  159. end
  160.  
  161.  
  162. if poly:contains(toPoint) then
  163. table.insert(hCollision, hero)
  164. else
  165. if pos ~= nil then
  166. distance1 = Point(pos.x, pos.z):distance(lineSegmentLeft)
  167. distance2 = Point(pos.x, pos.z):distance(lineSegmentRight)
  168. else
  169. distance1 = Point(hero.x, hero.z):distance(lineSegmentLeft)
  170. distance2 = Point(hero.x, hero.z):distance(lineSegmentRight)
  171. end
  172. if (distance1 < (getHitBoxRadius(hero)*2+10) or distance2 < (getHitBoxRadius(hero) *2+10)) then
  173. table.insert(hCollision, hero)
  174. end
  175. end
  176. end
  177. end
  178. end
  179. if #hCollision > 0 then return true, hCollision else return false, hCollision end
  180. end
  181.  
  182. function CollisionPE:GetCollision(pStart, pEnd)
  183. local b , minions = self:GetMinionCollision(pStart, pEnd)
  184. local t , heros = self:GetHeroCollision(pStart, pEnd, HERO_ENEMY)
  185.  
  186. if not b then return t, heros end
  187. if not t then return b, minions end
  188.  
  189. local all = {}
  190.  
  191. for index, hero in pairs(heros) do
  192. table.insert(all, hero)
  193. end
  194.  
  195. for index, minion in pairs(minions) do
  196. table.insert(all, minion)
  197. end
  198.  
  199. return true, all
  200. end
  201.  
  202.  
  203. function getHitBoxRadius(target)
  204. return GetDistance(target, target.minBBox)/2
  205. end
  206.  
  207.  
  208. _G.evade = false
  209. moveBuffer = 25
  210. smoothing = 75
  211. dashrange = 0
  212.  
  213.  
  214. champions = {}
  215. champions2 = {
  216. ["Lux"] = {charName = "Lux", skillshots = {
  217. ["Light Binding"] = {name = "LightBinding", spellName = "LuxLightBinding", spellDelay = 250, projectileName = "LuxLightBinding_mis.troy", projectileSpeed = 1200, range = 1300, radius = 80, type = "line", cc = "true", collision = "false", shieldnow = "true"},
  218. ["Lux LightStrike Kugel"] = {name = "LuxLightStrikeKugel", spellName = "LuxLightStrikeKugel", spellDelay = 250, projectileName = "LuxLightstrike_mis.troy", projectileSpeed = 1400, range = 1100, radius = 275, type = "circle", cc = "false", collision = "false", shieldnow = "false"},
  219. ["Lux Malice Cannon"] = {name = "LuxMaliceCannon", spellName = "LuxMaliceCannon", spellDelay = 1375, projectileName = "LuxMaliceCannon_cas.troy", projectileSpeed = 50000, range = 3500, radius = 190, type = "line", cc = "true", collision = "false", shieldnow = "true"},
  220. }},
  221. ["Nidalee"] = {charName = "Nidalee", skillshots = {
  222. ["Javelin Toss"] = {name = "JavelinToss", spellName = "JavelinToss", spellDelay = 125, projectileName = "nidalee_javelinToss_mis.troy", projectileSpeed = 1300, range = 1500, radius = 60, type = "line", cc = "true", collision = "true", shieldnow = "true"}
  223. }},
  224. ["Kennen"] = {charName = "Kennen", skillshots = {
  225. ["Thundering Shuriken"] = {name = "ThunderingShuriken", spellName = "KennenShurikenHurlMissile1", spellDelay = 180, projectileName = "kennen_ts_mis.troy", projectileSpeed = 1700, range = 1050, radius = 50, type = "line", cc = "false", collision = "true", shieldnow = "true"}
  226. }},
  227. ["Amumu"] = {charName = "Amumu", skillshots = {
  228. ["Bandage Toss"] = {name = "BandageToss", spellName = "BandageToss", spellDelay = 250, projectileName = "Bandage_beam.troy", projectileSpeed = 2000, range = 1100, radius = 80, type = "line", cc = "true", collision = "true", shieldnow = "true"}
  229. }},
  230. ["Lee Sin"] = {charName = "LeeSin", skillshots = {
  231. ["Sonic Wave"] = {name = "SonicWave", spellName = "BlindMonkQOne", spellDelay = 250, projectileName = "blindMonk_Q_mis_01.troy", projectileSpeed = 1800, range = 1100, radius = 70, type = "line", cc = "true", collision = "true", shieldnow = "true"}
  232. }},
  233. ["Morgana"] = {charName = "Morgana", skillshots = {
  234. ["Dark Binding Missile"] = {name = "DarkBinding", spellName = "DarkBindingMissile", spellDelay = 250, projectileName = "DarkBinding_mis.troy", projectileSpeed = 1200, range = 1300, radius = 80, type = "line", cc = "true", collision = "true", shieldnow = "true"},
  235. }},
  236. ["Sejuani"] = {charName = "Sejuani", skillshots = {
  237. ["SejuaniR"] = {name = "SejuaniR", spellName = "SejuaniGlacialPrisonCast", spellDelay = 250, projectileName = "Sejuani_R_mis.troy", projectileSpeed = 1600, range = 1200, radius = 110, type="line", cc = "true", collision = "false", shieldnow = "true"},
  238. }},
  239. ["Sona"] = {charName = "Sona", skillshots = {
  240. ["Crescendo"] = {name = "Crescendo", spellName = "SonaCrescendo", spellDelay = 240, projectileName = "SonaCrescendo_mis.troy", projectileSpeed = 2400, range = 1000, radius = 160, type = "line", cc = "true", collision = "false", shieldnow = "true"},
  241. }},
  242. ["Gragas"] = {charName = "Gragas", skillshots = {
  243. ["Barrel Roll"] = {name = "BarrelRoll", spellName = "GragasBarrelRoll", spellDelay = 250, projectileName = "gragas_barrelroll_mis.troy", projectileSpeed = 1000, range = 1115, radius = 180, type = "circle", cc = "false", collision = "false", shieldnow = "false"},
  244. ["Barrel Roll Missile"] = {name = "BarrelRollMissile", spellName = "GragasBarrelRollMissile", spellDelay = 0, projectileName = "gragas_barrelroll_mis.troy", projectileSpeed = 1000, range = 1115, radius = 180, type = "circle", cc = "false", collision = "false", shieldnow = "false"},
  245. }},
  246. ["Syndra"] = {charName = "Syndra", skillshots = {
  247. ["Q"] = {name = "Q", spellName = "SyndraQ", spellDelay = 250, projectileName = "Syndra_Q_fall.troy", projectileSpeed = 500, range = 825, radius = 175, type = "circular", cc = "false", collision = "false", shieldnow = "true"},
  248. ["W"] = {name = "W", spellName = "syndrawcast", spellDelay = 250, projectileName = "Syndra_W_fall.troy", projectileSpeed = 500, range = 950, radius = 200, type = "circular", cc = "false", collision = "false", shieldnow = "true"},
  249. }},
  250. ["Malphite"] = {charName = "Malphite", skillshots = {
  251. ["UFSlash"] = {name = "UFSlash", spellName = "UFSlash", spellDelay = 0, projectileName = "UnstoppableForce_cas.troy", projectileSpeed = 550, range = 1000, radius = 300, type="circular", cc = "true", collision = "false", shieldnow = "true"},
  252. }},
  253. ["Ezreal"] = {charName = "Ezreal", skillshots = {
  254. ["Mystic Shot"] = {name = "MysticShot", spellName = "EzrealMysticShot", spellDelay = 250, projectileName = "Ezreal_mysticshot_mis.troy", projectileSpeed = 2000, range = 1200, radius = 80, type = "line", cc = "false", collision = "true", shieldnow = "true"},
  255. ["Essence Flux"] = {name = "EssenceFlux", spellName = "EzrealEssenceFlux", spellDelay = 250, projectileName = "Ezreal_essenceflux_mis.troy", projectileSpeed = 1500, range = 1050, radius = 80, type = "line", cc = "false", collision = "false", shieldnow = "true"},
  256. ["Mystic Shot (Pulsefire)"] = {name = "MysticShot", spellName = "EzrealMysticShotPulse", spellDelay = 250, projectileName = "Ezreal_mysticshot_mis.troy", projectileSpeed = 2000, range = 1200, radius = 80, type = "line", cc = "false", collision = "true", shieldnow = "true"},
  257. ["Trueshot Barrage"] = {name = "TrueshotBarrage", spellName = "EzrealTrueshotBarrage", spellDelay = 1000, projectileName = "Ezreal_TrueShot_mis.troy", projectileSpeed = 2000, range = 20000, radius = 160, type = "line", cc = "false", collision = "false", shieldnow = "true"},
  258. }},
  259. ["Ahri"] = {charName = "Ahri", skillshots = {
  260. ["Orb of Deception"] = {name = "OrbofDeception", spellName = "AhriOrbofDeception", spellDelay = 250, projectileName = "Ahri_Orb_mis.troy", projectileSpeed = 2500, range = 900, radius = 100, type = "line", cc = "false", collision = "false", shieldnow = "true"},
  261. ["Orb of Deception Back"] = {name = "OrbofDeceptionBack", spellName = "AhriOrbofDeceptionherpityderp", spellDelay = 250+360, projectileName = "Ahri_Orb_mis_02.troy", projectileSpeed = 915, range = 900, radius = 100, type = "line", cc = "false", collision = "false", shieldnow = "true"},
  262. ["Charm"] = {name = "Charm", spellName = "AhriSeduce", spellDelay = 250, projectileName = "Ahri_Charm_mis.troy", projectileSpeed = 1000, range = 1000, radius = 60, type = "line", cc = "true", collision = "true", shieldnow = "true"}
  263. }},
  264. ["Olaf"] = {charName = "Olaf", skillshots = {
  265. ["Undertow"] = {name = "Undertow", spellName = "OlafAxeThrow", spellDelay = 250, projectileName = "olaf_axe_mis.troy", projectileSpeed = 1600, range = 1000, radius = 90, type = "line", cc = "true", collision = "false", shieldnow = "true"}
  266. }},
  267. ["Leona"] = {charName = "Leona", skillshots = {
  268. ["Zenith Blade"] = {name = "LeonaZenithBlade", spellName = "LeonaZenithBlade", spellDelay = 250, projectileName = "Leona_ZenithBlade_mis.troy", projectileSpeed = 2000, range = 950, radius = 110, type = "line", cc = "true", collision = "false", shieldnow = "true"},
  269. ["Leona Solar Flare"] = {name = "LeonaSolarFlare", spellName = "LeonaSolarFlare", spellDelay = 250, projectileName = "Leona_SolarFlare_cas.troy", projectileSpeed = 1500, range = 1200, radius = 300, type = "circular", cc = "true", collision = "false", shieldnow = "true"}
  270. }},
  271. ["Karthus"] = {charName = "Karthus", skillshots = {
  272. ["Lay Waste"] = {name = "LayWaste", spellName = "LayWaste", spellDelay = 250, projectileName = "LayWaste_point.troy", projectileSpeed = 1750, range = 875, radius = 140, type = "circular", cc = "false", collision = "false", shieldnow = "true"}
  273. }},
  274. ["Chogath"] = {charName = "Chogath", skillshots = {
  275. ["Rupture"] = {name = "Rupture", spellName = "Rupture", spellDelay = 0, projectileName = "rupture_cas_01_red_team.troy", projectileSpeed = 950, range = 950, radius = 250, type = "circular", cc = "true", collision = "false", shieldnow = "true"}
  276. }},
  277. ["Blitzcrank"] = {charName = "Blitzcrank", skillshots = {
  278. ["Rocket Grab"] = {name = "RocketGrab", spellName = "RocketGrabMissile", spellDelay = 250, projectileName = "FistGrab_mis.troy", projectileSpeed = 1800, range = 1050, radius = 70, type = "line", cc = "true", collision = "true", shieldnow = "true"},
  279. }},
  280. ["Anivia"] = {charName = "Anivia", skillshots = {
  281. ["Flash Frost"] = {name = "FlashFrost", spellName = "FlashFrostSpell", spellDelay = 250, projectileName = "cryo_FlashFrost_mis.troy", projectileSpeed = 850, range = 1100, radius = 110, type = "line", cc = "true", collision = "false", shieldnow = "true"}
  282. }},
  283. ["Zyra"] = {charName = "Zyra", skillshots = {
  284. ["Grasping Roots"] = {name = "GraspingRoots", spellName = "ZyraGraspingRoots", spellDelay = 250, projectileName = "Zyra_E_sequence_impact.troy", projectileSpeed = 1150, range = 1150, radius = 70, type = "line", cc = "true", collision = "false", shieldnow = "true"},
  285. ["Zyra Passive Death"] = {name = "ZyraPassive", spellName = "zyrapassivedeathmanager", spellDelay = 500, projectileName = "zyra_passive_plant_mis.troy", projectileSpeed = 2000, range = 1474, radius = 60, type = "line", cc = "false", collision = "false", shieldnow = "true"},
  286. }},
  287. ["Nautilus"] = {charName = "Nautilus", skillshots = {
  288. ["Dredge Line"] = {name = "DredgeLine", spellName = "NautilusAnchorDrag", spellDelay = 250, projectileName = "Nautilus_Q_mis.troy", projectileSpeed = 2000, range = 1080, radius = 80, type = "line", cc = "true", collision = "true", shieldnow = "true"},
  289. }},
  290. ["Caitlyn"] = {charName = "Caitlyn", skillshots = {
  291. ["Piltover Peacemaker"] = {name = "PiltoverPeacemaker", spellName = "CaitlynPiltoverPeacemaker", spellDelay = 625, projectileName = "caitlyn_Q_mis.troy", projectileSpeed = 2200, range = 1300, radius = 90, type = "line", cc = "false", collision = "false", shieldnow = "true"},
  292. ["Caitlyn Entrapment"] = {name = "CaitlynEntrapment", spellName = "CaitlynEntrapment", spellDelay = 150, projectileName = "caitlyn_entrapment_mis.troy", projectileSpeed = 2000, range = 950, radius = 80, type = "line", cc = "true", collision = "true", shieldnow = "true"},
  293. }},
  294. ["Mundo"] = {charName = "DrMundo", skillshots = {
  295. ["Infected Cleaver"] = {name = "InfectedCleaver", spellName = "InfectedCleaverMissile", spellDelay = 250, projectileName = "dr_mundo_infected_cleaver_mis.troy", projectileSpeed = 2000, range = 1050, radius = 75, type = "line", cc = "true", collision = "true", shieldnow = "true"},
  296. }},
  297. ["Brand"] = {charName = "Brand", skillshots = {
  298. ["BrandBlaze"] = {name = "BrandBlaze", spellName = "BrandBlaze", spellDelay = 250, projectileName = "BrandBlaze_mis.troy", projectileSpeed = 1600, range = 1100, radius = 80, type = "line", cc = "true", collision = "true", shieldnow = "true"},
  299. ["Pillar of Flame"] = {name = "PillarofFlame", spellName = "BrandFissure", spellDelay = 250, projectileName = "BrandPOF_tar_green.troy", projectileSpeed = 900, range = 1100, radius = 240, type = "circular", cc = "false", collision = "false", shieldnow = "true"}
  300. }},
  301. ["Corki"] = {charName = "Corki", skillshots = {
  302. ["Missile Barrage"] = {name = "MissileBarrage", spellName = "MissileBarrage", spellDelay = 250, projectileName = "corki_MissleBarrage_mis.troy", projectileSpeed = 2000, range = 1300, radius = 40, type = "line", cc = "false", collision = "true", shieldnow = "true"},
  303. ["Missile Barrage big"] = {name = "MissileBarragebig", spellName = "MissileBarrage!", spellDelay = 250, projectileName = "Corki_MissleBarrage_DD_mis.troy", projectileSpeed = 2000, range = 1300, radius = 40, type = "line", cc = "false", collision = "true", shieldnow = "true"}
  304. }},
  305. ["TwistedFate"] = {charName = "TwistedFate", skillshots = {
  306. ["Loaded Dice"] = {name = "LoadedDice", spellName = "WildCards", spellDelay = 250, projectileName = "Roulette_mis.troy", projectileSpeed = 1000, range = 1450, radius = 40, type = "line", cc = "false", collision = "false", shieldnow = "true"},
  307. }},
  308. ["Swain"] = {charName = "Swain", skillshots = {
  309. ["Nevermove"] = {name = "Nevermove", spellName = "SwainShadowGrasp", spellDelay = 250, projectileName = "swain_shadowGrasp_transform.troy", projectileSpeed = 1000, range = 900, radius = 180, type = "circular", cc = "true", collision = "false", shieldnow = "true"}
  310. }},
  311. ["Cassiopeia"] = {charName = "Cassiopeia", skillshots = {
  312. ["Noxious Blast"] = {name = "NoxiousBlast", spellName = "CassiopeiaNoxiousBlast", spellDelay = 250, projectileName = "CassNoxiousSnakePlane_green.troy", projectileSpeed = 500, range = 850, radius = 130, type = "circular", cc = "false", collision = "false", shieldnow = "true"},
  313. }},
  314. ["Sivir"] = {charName = "Sivir", skillshots = {
  315. ["Boomerang Blade"] = {name = "BoomerangBlade", spellName = "SivirQ", spellDelay = 250, projectileName = "Sivir_Base_Q_mis.troy", projectileSpeed = 1350, range = 1175, radius = 101, type = "line", cc = "false", collision = "false", shieldnow = "true"},
  316. }},
  317. ["Ashe"] = {charName = "Ashe", skillshots = {
  318. ["Enchanted Arrow"] = {name = "EnchantedArrow", spellName = "EnchantedCrystalArrow", spellDelay = 250, projectileName = "EnchantedCrystalArrow_mis.troy", projectileSpeed = 1600, range = 25000, radius = 120, type = "line", cc = "true", collision = "false", shieldnow = "true"},
  319. }},
  320. ["KogMaw"] = {charName = "KogMaw", skillshots = {
  321. ["Living Artillery"] = {name = "LivingArtillery", spellName = "KogMawLivingArtillery", spellDelay = 250, projectileName = "KogMawLivingArtillery_mis.troy", projectileSpeed = 1050, range = 2200, radius = 225, type = "circular", cc = "false", collision = "false", shieldnow = "true"}
  322. }},
  323. ["Khazix"] = {charName = "Khazix", skillshots = {
  324. ["KhazixW"] = {name = "KhazixW", spellName = "KhazixW", spellDelay = 250, projectileName = "Khazix_W_mis_enhanced.troy", projectileSpeed = 1700, range = 1025, radius = 70, type = "line", cc = "true", collision = "true", shieldnow = "true"},
  325. ["khazixwlong"] = {name = "khazixwlong", spellName = "khazixwlong", spellDelay = 250, projectileName = "Khazix_W_mis_enhanced.troy", projectileSpeed = 1700, range = 1025, radius = 70, type = "line", cc = "true", collision = "true", shieldnow = "true"},
  326. }},
  327. ["Zed"] = {charName = "Zed", skillshots = {
  328. ["ZedShuriken"] = {name = "ZedShuriken", spellName = "ZedShuriken", spellDelay = 250, projectileName = "Zed_Q_Mis.troy", projectileSpeed = 1700, range = 925, radius = 50, type = "line", cc = "false", collision = "false", shieldnow = "true"},
  329. }},
  330. ["Leblanc"] = {charName = "Leblanc", skillshots = {
  331. ["Ethereal Chains"] = {name = "EtherealChains", spellName = "LeblancSoulShackle", spellDelay = 250, projectileName = "leBlanc_shackle_mis.troy", projectileSpeed = 1600, range = 960, radius = 70, type = "line", cc = "true", collision = "true", shieldnow = "true"},
  332. ["Ethereal Chains R"] = {name = "EtherealChainsR", spellName = "LeblancSoulShackleM", spellDelay = 250, projectileName = "leBlanc_shackle_mis_ult.troy", projectileSpeed = 1600, range = 960, radius = 70, type = "line", cc = "true", collision = "true", shieldnow = "true"},
  333. }},
  334. ["Draven"] = {charName = "Draven", skillshots = {
  335. ["Stand Aside"] = {name = "StandAside", spellName = "DravenDoubleShot", spellDelay = 250, projectileName = "Draven_E_mis.troy", projectileSpeed = 1400, range = 1100, radius = 130, type = "line", cc = "true", collision = "false", shieldnow = "true"},
  336. ["DravenR"] = {name = "DravenR", spellName = "DravenRCast", spellDelay = 500, projectileName = "Draven_R_mis!.troy", projectileSpeed = 2000, range = 25000, radius = 160, type = "line", cc = "false", collision = "false", shieldnow = "true"},
  337. }},
  338. ["Elise"] = {charName = "Elise", skillshots = {
  339. ["Cocoon"] = {name = "Cocoon", spellName = "EliseHumanE", spellDelay = 250, projectileName = "Elise_human_E_mis.troy", projectileSpeed = 1450, range = 1100, radius = 70, type = "line", cc = "true", collision = "true", shieldnow = "true"}
  340. }},
  341. ["Lulu"] = {charName = "Lulu", skillshots = {
  342. ["LuluQ"] = {name = "LuluQ", spellName = "LuluQ", spellDelay = 250, projectileName = "Lulu_Q_Mis.troy", projectileSpeed = 1450, range = 1000, radius = 50, type = "line", cc = "true", collision = "false", shieldnow = "true"}
  343. }},
  344. ["Thresh"] = {charName = "Thresh", skillshots = {
  345. ["ThreshQ"] = {name = "ThreshQ", spellName = "ThreshQ", spellDelay = 500, projectileName = "Thresh_Q_whip_beam.troy", projectileSpeed = 1900, range = 1100, radius = 65, type = "line", cc = "true", collision = "true", shieldnow = "true"}
  346. }},
  347. ["Shen"] = {charName = "Shen", skillshots = {
  348. ["ShadowDash"] = {name = "ShadowDash", spellName = "ShenShadowDash", spellDelay = 0, projectileName = "shen_shadowDash_mis.troy", projectileSpeed = 3000, range = 575, radius = 50, type = "line", cc = "true", collision = "false", shieldnow = "true"}
  349. }},
  350. ["Quinn"] = {charName = "Quinn", skillshots = {
  351. ["QuinnQ"] = {name = "QuinnQ", spellName = "QuinnQ", spellDelay = 250, projectileName = "Quinn_Q_missile.troy", projectileSpeed = 1550, range = 1050, radius = 80, type = "line", cc = "false", collision = "true", shieldnow = "true"}
  352. }},
  353. ["Veigar"] = {charName = "Veigar", skillshots = {
  354. ["Dark Matter"] = {name = "VeigarDarkMatter", spellName = "VeigarDarkMatter", spellDelay = 250, projectileName = "!", projectileSpeed = 900, range = 900, radius = 225, type = "circular", cc = "false", collision = "false", shieldnow = "true"}
  355. }},
  356. ["Jayce"] = {charName = "Jayce", skillshots = {
  357. ["JayceShockBlast"] = {name = "JayceShockBlast", spellName = "jayceshockblast", spellDelay = 250, projectileName = "JayceOrbLightning.troy", projectileSpeed = 1450, range = 1050, radius = 70, type = "line", cc = "false", collision = "true", shieldnow = "true"},
  358. ["JayceShockBlastCharged"] = {name = "JayceShockBlastCharged", spellName = "jayceshockblast", spellDelay = 250, projectileName = "JayceOrbLightningCharged.troy", projectileSpeed = 2350, range = 1600, radius = 70, type = "line", cc = "false", collision = "true", shieldnow = "true"},
  359. }},
  360. ["Nami"] = {charName = "Nami", skillshots = {
  361. ["NamiQ"] = {name = "NamiQ", spellName = "NamiQ", spellDelay = 250, projectileName = "Nami_Q_mis.troy", projectileSpeed = 1500, range = 1625, radius = 225, type = "circle", cc = "true", collision = "false", shieldnow = "true"}
  362. }},
  363. ["Fizz"] = {charName = "Fizz", skillshots = {
  364. ["Fizz Ultimate"] = {name = "FizzULT", spellName = "FizzMarinerDoom", spellDelay = 250, projectileName = "Fizz_UltimateMissile.troy", projectileSpeed = 1350, range = 1275, radius = 80, type = "line", cc = "true", collision = "false", shieldnow = "true"},
  365. }},
  366. ["Varus"] = {charName = "Varus", skillshots = {
  367. ["Varus Q Missile"] = {name = "VarusQMissile", spellName = "somerandomspellnamethatwillnevergetcalled", spellDelay = 0, projectileName = "VarusQ_mis.troy", projectileSpeed = 1900, range = 1600, radius = 70, type = "line", cc = "false", collision = "false", shieldnow = "true"},
  368. ["VarusR"] = {name = "VarusR", spellName = "VarusR", spellDelay = 250, projectileName = "VarusRMissile.troy", projectileSpeed = 1950, range = 1250, radius = 100, type = "line", cc = "true", collision = "false", shieldnow = "true"},
  369. }},
  370. ["Karma"] = {charName = "Karma", skillshots = {
  371. ["KarmaQ"] = {name = "KarmaQ", spellName = "KarmaQ", spellDelay = 250, projectileName = "TEMP_KarmaQMis.troy", projectileSpeed = 1700, range = 1050, radius = 90, type = "line", cc = "true", collision = "true", shieldnow = "true"},
  372. }},
  373. ["Aatrox"] = {charName = "Aatrox", skillshots = {
  374. ["Blade of Torment"] = {name = "BladeofTorment", spellName = "AatroxE", spellDelay = 250, projectileName = "AatroxBladeofTorment_mis.troy", projectileSpeed = 1200, range = 1075, radius = 75, type = "line", cc = "true", collision = "false", shieldnow = "true"},
  375. ["AatroxQ"] = {name = "AatroxQ", spellName = "AatroxQ", spellDelay = 250, projectileName = "AatroxQ.troy", projectileSpeed = 450, range = 650, radius = 145, type = "circle", cc = "true", collision = "false", shieldnow = "true"},
  376. }},
  377. ["Xerath"] = {charName = "Xerath", skillshots = {
  378. ["Xerath Arcanopulse"] = {name = "XerathArcanopulse", spellName = "XerathArcanopulse", spellDelay = 1375, projectileName = "Xerath_Beam_cas.troy", projectileSpeed = 25000, range = 1025, radius = 100, type = "line", cc = "false", collision = "false", shieldnow = "true"},
  379. ["Xerath Arcanopulse Extended"] = {name = "XerathArcanopulseExtended", spellName = "xeratharcanopulseextended", spellDelay = 1375, projectileName = "Xerath_Beam_cas.troy", projectileSpeed = 25000, range = 1625, radius = 100, type = "line", cc = "false", collision = "false", shieldnow = "true"},
  380. ["xeratharcanebarragewrapper"] = {name = "xeratharcanebarragewrapper", spellName = "xeratharcanebarragewrapper", spellDelay = 250, projectileName = "Xerath_E_cas.troy", projectileSpeed = 300, range = 1100, radius = 265, type = "circular", cc = "false", collision = "false", shieldnow = "true"},
  381. ["xeratharcanebarragewrapperext"] = {name = "xeratharcanebarragewrapperext", spellName = "xeratharcanebarragewrapperext", spellDelay = 250, projectileName = "Xerath_E_cas.troy", projectileSpeed = 300, range = 1700, radius = 265, type = "circular", cc = "false", collision = "false", shieldnow = "true"},
  382. }},
  383. ["Lucian"] = {charName = "Lucian", skillshots = {
  384. ["LucianQ"] = {name = "LucianQ", spellName = "LucianQ", spellDelay = 350, projectileName = "Lucian_Q_laser.troy", projectileSpeed = 25000, range = 570*2, radius = 65, type = "line", cc = "false", collision = "false", shieldnow = "true"},
  385. ["LucianW"] = {name = "LucianW", spellName = "LucianW", spellDelay = 300, projectileName = "Lucian_W_mis.troy", projectileSpeed = 1600, range = 1000, radius = 80, type = "line", cc = "false", collision = "false", shieldnow = "true"},
  386. }},
  387. ["Viktor"] = {charName = "Viktor", skillshots = {
  388. ["ViktorDeathRay1"] = {name = "ViktorDeathRay1", spellName = "ViktorDeathRay!", spellDelay = 500, projectileName = "Viktor_DeathRay_Fix_Mis.troy", projectileSpeed = 780, range = 700, radius = 80, type = "line", cc = "false", collision = "false", shieldnow = "true"},
  389. ["ViktorDeathRay2"] = {name = "ViktorDeathRay2", spellName = "ViktorDeathRay!", spellDelay = 500, projectileName = "Viktor_DeathRay_Fix_Mis_Augmented.troy", projectileSpeed = 780, range = 700, radius = 80, type = "line", cc = "false", collision = "false", shieldnow = "true"},
  390. }},
  391. ["Rumble"] = {charName = "Rumble", skillshots = {
  392. ["RumbleGrenade"] = {name = "RumbleGrenade", spellName = "RumbleGrenade", spellDelay = 250, projectileName = "rumble_taze_mis.troy", projectileSpeed = 2000, range = 950, radius = 90, type = "line", cc = "true", collision = "true", shieldnow = "true"},
  393. }},
  394. ["Nocturne"] = {charName = "Nocturne", skillshots = {
  395. ["NocturneDuskbringer"] = {name = "NocturneDuskbringer", spellName = "NocturneDuskbringer", spellDelay = 250, projectileName = "NocturneDuskbringer_mis.troy", projectileSpeed = 1400, range = 1125, radius = 60, type = "line", cc = "false", collision = "false", shieldnow = "true"},
  396. }},
  397. ["Yasuo"] = {charName = "Yasuo", skillshots = {
  398. ["yasuoq3"] = {name = "yasuoq3", spellName = "yasuoq3w", spellDelay = 250, projectileName = "Yasuo_Q_wind_mis.troy", projectileSpeed = 1200, range = 1000, radius = 80, type = "line", cc = "true", collision = "false", shieldnow = "true"},
  399. ["yasuoq1"] = {name = "yasuoq1", spellName = "yasuoQW", spellDelay = 250, projectileName = "Yasuo_Q_WindStrike.troy", projectileSpeed = 25000, range = 475, radius = 40, type = "line", cc = "false", collision = "false", shieldnow = "true"},
  400. ["yasuoq2"] = {name = "yasuoq2", spellName = "yasuoq2w", spellDelay = 250, projectileName = "Yasuo_Q_windstrike_02.troy", projectileSpeed = 25000, range = 475, radius = 40, type = "line", cc = "false", collision = "false", shieldnow = "true"},
  401. }},
  402. ["Orianna"] = {charName = "Orianna", skillshots = {
  403. ["OrianaIzunaCommand"] = {name = "OrianaIzunaCommand", spellName = "OrianaIzunaCommand", spellDelay = 0, projectileName = "Oriana_Ghost_mis.troy", projectileSpeed = 1300, range = 800, radius = 80, type = "line", cc = "true", collision = "false", shieldnow = "true"},
  404. ["OrianaDetonateCommand"] = {name = "OrianaDetonateCommand", spellName = "OrianaDetonateCommand", spellDelay = 100, projectileName = "Oriana_Shockwave_nova.troy", projectileSpeed = 400, range = 2000, radius = 400, type = "circular", cc = "true", collision = "false", shieldnow = "true"},
  405. }},
  406. ["Ziggs"] = {charName = "Ziggs", skillshots = {
  407. ["ZiggsQ"] = {name = "ZiggsQ", spellName = "ZiggsQ", spellDelay = 250, projectileName = "ZiggsQ.troy", projectileSpeed = 1700, range = 1400, radius = 155, type = "line", cc = "false", collision = "true", shieldnow = "true"},
  408. }},
  409. ["Annie"] = {charName = "Annie", skillshots = {
  410. ["AnnieR"] = {name = "AnnieR", spellName = "InfernalGuardian", spellDelay = 100, projectileName = "nothing", projectileSpeed = 0, range = 600, radius = 300, type = "circular", cc = "true", collision = "false", shieldnow = "true"},
  411. }},
  412. ["Galio"] = {charName = "Galio", skillshots = {
  413. ["GalioResoluteSmite"] = {name = "GalioResoluteSmite", spellName = "GalioResoluteSmite", spellDelay = 250, projectileName = "galio_concussiveBlast_mis.troy", projectileSpeed = 850, range = 2000, radius = 200, type = "circle", cc = "true", collision = "false", shieldnow = "true"},
  414. }},
  415. ["Jinx"] = {charName = "Jinx", skillshots = {
  416. ["W"] = {name = "Zap", spellName = "JinxW", spellDelay = 600, projectileName = "Jinx_W_Beam.troy", projectileSpeed = 3300, range = 1450, radius = 70, type = "line", cc = "true", collision = "true", shieldnow = "true"},
  417. ["R"] = {name = "SuperMegaDeathRocket", spellName = "JinxRWrapper", spellDelay = 600, projectileName = "Jinx_R_Mis.troy", projectileSpeed = 1700, range = 20000, radius = 120, type = "line", cc = "false", collision = "false", shieldnow = "true"},
  418. }},
  419. }
  420. wrotedisclaimer = false
  421. enemyes = {}
  422. nAllies = 0
  423. allies = {}
  424. nEnemies = 0
  425. evading = false
  426. allowCustomMovement = true
  427. captureMovements = true
  428. lastMovement = {}
  429. detectedSkillshots = {}
  430. nSkillshots = 0
  431. CastingSpell = false
  432. lastset = 0
  433. trueWidth = {}
  434. trueSpeed = {}
  435. trueDelay = {}
  436. haveflash = false
  437. flashSlot = nil
  438. flashready = false
  439. lastspell = "Q"
  440. useflash = false
  441. shieldslot = _E
  442. shieldtick = nil
  443. alreadywritten = false
  444. thatfile = SCRIPT_PATH.."movementblock.txt"
  445. currentbuffer = 0
  446. bufferset = false
  447.  
  448. function getTarget(targetId)
  449. if targetId ~= 0 and targetId ~= nil then
  450. return objManager:GetObjectByNetworkId(targetId)
  451. end
  452. return nil
  453. end
  454.  
  455. function OnSendPacket(p)
  456. if VIP_USER then
  457. local packet = Packet(p)
  458. if packet:get('name') == 'S_MOVE' then
  459. if packet:get('sourceNetworkId') == myHero.networkID then
  460. if captureMovements then
  461. lastMovement.destination = Point2(packet:get('x'), packet:get('y'))
  462. lastMovement.type = packet:get('type')
  463. lastMovement.targetId = packet:get('targetNetworkId')
  464.  
  465. if evading then
  466. for i, detectedSkillshot in pairs(detectedSkillshots) do
  467. if detectedSkillshot and detectedSkillshot.evading and inDangerousArea(detectedSkillshot, Point2(myHero.x, myHero.z)) then
  468. dodgeSkillshot(detectedSkillshot)
  469. break
  470. end
  471. end
  472. end
  473. end
  474. if not allowCustomMovement then
  475. packet:block()
  476. end
  477. end
  478. elseif packet:get('name') == 'S_CAST' then
  479. if captureMovements then
  480. lastMovement.spellId = packet:get('spellId')
  481. lastMovement.type = 7
  482. lastMovement.targetId = packet:get('targetNetworkId')
  483. lastMovement.destination = Point2(packet:get('toX'), packet:get('toY'))
  484.  
  485. if evading then
  486. for i, detectedSkillshot in pairs(detectedSkillshots) do
  487. if detectedSkillshot and detectedSkillshot.evading and inDangerousArea(detectedSkillshot, Point2(myHero.x, myHero.z)) then
  488. dodgeSkillshot(detectedSkillshot)
  489. break
  490. end
  491. end
  492. end
  493. end
  494.  
  495. if not allowCustomMovement then
  496. if packet:get('spellId') == 12 then
  497. else
  498. packet:block()
  499. end
  500. end
  501. end
  502. end
  503. end
  504.  
  505. function getLastMovementDestination()
  506. if VIP_USER then
  507. if lastMovement.type == 3 then
  508. heroPosition = Point2(myHero.x, myHero.z)
  509.  
  510. target = getTarget(lastMovement.targetId)
  511. if _isValidTarget(target) then
  512. targetPosition = Point2(target.x, target.z)
  513.  
  514. local attackRange = (myHero.range + GetDistance(myHero.minBBox, myHero.maxBBox) / 2 + GetDistance(target.minBBox, target.maxBBox) / 2)
  515.  
  516. if attackRange <= heroPosition:distance(targetPosition) then
  517. return targetPosition + (heroPosition - targetPosition):normalized() * attackRange
  518. else
  519. return heroPosition
  520. end
  521. else
  522. return heroPosition
  523. end
  524. elseif lastMovement.type == 7 then
  525. heroPosition = Point2(myHero.x, myHero.z)
  526.  
  527. target = getTarget(lastMovement.targetId)
  528. if _isValidTarget(target) then
  529. targetPosition = Point2(target.x, target.z)
  530.  
  531. local castRange = myHero:GetSpellData(lastMovement.spellId).range
  532.  
  533. if castRange <= heroPosition:distance(targetPosition) then
  534. return targetPosition + (heroPosition - targetPosition):normalized() * castRange
  535. else
  536. return heroPosition
  537. end
  538. else
  539. local castRange = myHero:GetSpellData(lastMovement.spellId).range
  540.  
  541. if castRange <= heroPosition:distance(lastMovement.destination) then
  542. return lastMovement.destination + (heroPosition - lastMovement.destination):normalized() * castRange
  543. else
  544. return heroPosition
  545. end
  546. end
  547. else
  548. return lastMovement.destination
  549. end
  550. else return lastMovement.destination
  551. end
  552. end
  553. function CheckBall(obj)
  554. if obj == nil or obj.name == nil then return end
  555.  
  556. if (obj.name:find("Oriana_Ghost_mis") or obj.name:find("Oriana_Ghost_mis_protect") ) then
  557. ball = nil
  558. return
  559. end
  560.  
  561. if obj.name:find("yomu_ring_red") then
  562. ball = obj
  563. return
  564. end
  565.  
  566. if obj.name:find("Oriana_Ghost_bind") then
  567. for i, target in pairs(enemyes) do
  568. if GetDistance(target, obj) < 50 then
  569. ball = target
  570. end
  571. end
  572. end
  573. end
  574.  
  575. function OnLoad()
  576. ball = nil
  577. GoodEvadeConfig = scriptConfig("Freaking Good Evade", "Freaking Good Evade")
  578. GoodEvadeConfig:addParam("evadeBuffer", "Increase Skillshot width by...", SCRIPT_PARAM_SLICE, 15, 0, 50, 0 )
  579. GoodEvadeConfig:addParam("lineallways", "Allways try to dodge line skillshots", SCRIPT_PARAM_ONOFF, true)
  580. GoodEvadeConfig:addParam("fowdelay", "Delay for skillshots in FOW", SCRIPT_PARAM_SLICE, 1, 1, 20, 0)
  581. GoodEvadeConfig:addParam("dodgeEnabled", "Dodge Skillshots", SCRIPT_PARAM_ONOFF, true)
  582. GoodEvadeConfig:addParam("drawEnabled", "Draw Skillshots", SCRIPT_PARAM_ONOFF, true)
  583. GoodEvadeConfig:addParam("dodgeCConly", "Dodge CC only spells", SCRIPT_PARAM_ONKEYDOWN, false, 32)
  584. GoodEvadeConfig:addParam("dodgeCConly2", "Dodge CC only spells toggle", SCRIPT_PARAM_ONKEYTOGGLE, false, 77)
  585. GoodEvadeConfig:addParam("resetdodge", "Reset Dodge", SCRIPT_PARAM_ONKEYDOWN, false, 17)
  586. GoodEvadeConfig:addParam("usedashes", "Use Dash to dodge spells", SCRIPT_PARAM_ONOFF, true)
  587. GoodEvadeConfig:addParam("useflash", "Use Flash to dodge dangerous spells", SCRIPT_PARAM_ONOFF, true)
  588. GoodEvadeConfig:addParam("freemovementblock", "Free Users Movement Block", SCRIPT_PARAM_ONOFF, false)
  589. GoodEvadeConfig:permaShow("dodgeEnabled")
  590. for i = 1, heroManager.iCount do
  591. local hero = heroManager:GetHero(i)
  592. if hero.team ~= myHero.team then
  593. for i, skillShotChampion in pairs(champions2) do
  594. if skillShotChampion.charName == hero.charName then
  595. table.insert(champions, skillShotChampion)
  596. end
  597. end
  598. end
  599. end
  600. GoodEvadeSkillshotConfig = scriptConfig("FGE skillshots", "FGE skillshots config")
  601. for i, skillShotChampion in pairs(champions) do
  602. for i, skillshot in pairs(skillShotChampion.skillshots) do
  603. name = tostring(skillshot.name)
  604. name2 = tostring(skillshot.name)
  605. if skillshot.cc == "true" then
  606. GoodEvadeSkillshotConfig:addParam(name, "Dodge "..name2, SCRIPT_PARAM_SLICE, 2, 0, 2, 0)
  607. elseif skillshot.cc == "false" then GoodEvadeSkillshotConfig:addParam(name, "Dodge "..name2, SCRIPT_PARAM_SLICE, 1, 0, 2, 0)
  608. elseif skillshot.cc == "never" then GoodEvadeSkillshotConfig:addParam(name, "Dodge "..name2, SCRIPT_PARAM_SLICE, 0, 0, 2, 0)
  609. end
  610. end
  611. end
  612.  
  613. stopEvade()
  614. isSivir = false
  615. if myHero.charName == "Sivir" then
  616. isSivir = true
  617. end
  618. isNocturne = false
  619. if myHero.charName == "Nocturne" then
  620. isNocturne = true
  621. end
  622. isVayne = false
  623. if myHero.charName == "Vayne" then
  624. isVayne = true
  625. end
  626. isGraves = false
  627. if myHero.charName == "Graves" then
  628. isGraves = true
  629. end
  630. isEzreal = false
  631. if myHero.charName == "Ezreal" then
  632. isEzreal = true
  633. end
  634. if myHero.charName == "Caitlyn"
  635. then isCaitlyn = true
  636. end
  637. isLeblanc = false
  638. if myHero.charName == "Leblanc" then
  639. isLeblanc = true
  640. end
  641. isRiven = false
  642. if myHero.charName == "Riven" then
  643. isRiven = true
  644. end
  645. isFizz = false
  646. if myHero.charName == "Fizz" then
  647. isFizz = true
  648. end
  649. isShen = false
  650. if myHero.charName == "Shen" then
  651. isShen = true
  652. end
  653. isShaco = false
  654. if myHero.charName == "Shaco" then
  655. isShaco = true
  656. end
  657. isRenekton = false
  658. if myHero.charName == "Renekton" then
  659. isRenekton = true
  660. end
  661. isTristana = false
  662. if myHero.charName == "Tristana" then
  663. isTristana = true
  664. end
  665. isTryndamere = false
  666. if myHero.charName == "Tryndamere" then
  667. isTryndamere = true
  668. end
  669. isCorki = false
  670. if myHero.charName == "Corki" then
  671. isCorki = true
  672. end
  673. isLucian = false
  674. if myHero.charName == "Lucian" then
  675. isLucian = true
  676. end
  677. if myHero:GetSpellData(SUMMONER_1).name:find("SummonerFlash") then
  678. haveflash = true
  679. flashSlot = SUMMONER_1
  680. elseif myHero:GetSpellData(SUMMONER_2).name:find("SummonerFlash") then
  681. flashSlot = SUMMONER_2
  682. haveflash = true
  683. end
  684.  
  685. lastMovement = {
  686. destination = Point2(myHero.x, myHero.z),
  687. moveCommand = Point2(myHero.x, myHero.z),
  688. type = 2,
  689. targetId = nil,
  690. spellId = nil,
  691. approachedPoint = nil
  692. }
  693.  
  694. for i = 1, heroManager.iCount do
  695. local hero = heroManager:GetHero(i)
  696. if hero.team ~= myHero.team then
  697. table.insert(enemyes, hero)
  698. elseif hero.team == myHero.team and hero.nEnemies ~= myHero.networkID then
  699. table.insert(allies, hero)
  700. end
  701. end
  702. isOrianna = false
  703. for i, enemy in pairs(enemyes) do
  704. if enemy.charName == "Orianna" then
  705. isOrianna = true
  706. end
  707. end
  708. if #enemyes == 5 then
  709. for i, skillShotChampion in pairs(champions) do
  710. if skillShotChampion.charName ~= enemyes[1].charName and skillShotChampion.charName ~= enemyes[2].charName and skillShotChampion.charName ~= enemyes[3].charName
  711. and skillShotChampion.charName ~= enemyes[4].charName and skillShotChampion.charName ~= enemyes[5].charName then
  712. champions[i] = nil
  713. end
  714. end
  715. end
  716.  
  717. player:RemoveCollision()
  718. player:SetVisionRadius(1700)
  719.  
  720. GoodEvadeConfig.dodgeEnabled = true
  721. currentbuffer = GoodEvadeConfig.evadeBuffer
  722.  
  723. PrintChat(" >> Freaking Good Evade v"..version.." loaded")
  724. PrintChat(versionmessage)
  725. if AutoUpdate then
  726. DelayAction(Update, 10)
  727. end
  728. end
  729.  
  730.  
  731.  
  732. function getSideOfLine(linePoint1, linePoint2, point)
  733. if not point then return 0 end
  734. result = ((linePoint2.x - linePoint1.x) * (point.y - linePoint1.y) - (linePoint2.y - linePoint1.y) * (point.x - linePoint1.x))
  735. if result < 0 then
  736. return -1
  737. elseif result > 0 then
  738. return 1
  739. else
  740. return 0
  741. end
  742. end
  743. colstartpos = nil
  744. colendpos = nil
  745. function dodgeSkillshot(skillshot)
  746. if GoodEvadeConfig.dodgeEnabled and not myHero.dead and CastingSpell == false then
  747. if skillshot.skillshot.type == "line" then
  748. if skillshot.skillshot.collision == "true" and VIP_USER then
  749. heropos = Point2(myHero.x, myHero.z)
  750. endposition = skillshot.startPosition + (skillshot.endPosition - skillshot.startPosition):normalized() * (heropos:distance(skillshot.startPosition))
  751. colstartpos = Vector(skillshot.startPosition.x, myHero.y, skillshot.startPosition.y)
  752. colendpos = Vector(endposition.x, myHero.y, endposition.y)
  753. collisionshit = CollisionPE(skillshot.skillshot.range, skillshot.skillshot.projectileSpeed, skillshot.skillshot.spellDelay, skillshot.skillshot.radius)
  754. if collisionshit:GetMinionCollision(colstartpos, colendpos) then return end
  755. end
  756. dodgeLineShot(skillshot)
  757. else
  758. dodgeCircularShot(skillshot)
  759. end
  760. end
  761. end
  762.  
  763. function dodgeCircularShot(skillshot)
  764. skillshot.evading = true
  765. alreadydodged = false
  766. heroPosition = Point2(myHero.x, myHero.z)
  767.  
  768. moveableDistance = myHero.ms * math.max(skillshot.endTick - GetTickCount() - GetLatency()/2, 0) / 1000
  769. evadeRadius = skillshot.skillshot.radius + hitboxSize / 2 + GoodEvadeConfig.evadeBuffer + moveBuffer
  770.  
  771. safeTarget = skillshot.endPosition + (heroPosition - skillshot.endPosition):normalized() * evadeRadius
  772.  
  773. if skillshot.skillshot.name == "UFSlash" or skillshot.skillshot.name == "AnnieR" then
  774. if AM1(skillshot) then
  775. alreadydodged = true
  776. elseif AM2(skillshot, heroPosition) then
  777. alreadydodged = true
  778. elseif AM3(skillshot, safeTarget) then
  779. alreadydodged = true
  780. end
  781. end
  782. if not alreadydodged then
  783. if mainCircularskillshot1(skillshot, heroPosition, moveableDistance, evadeRadius, safeTarget) then
  784. alreadydodged = true
  785. elseif mainCircularskillshot2(skillshot) then
  786. alreadydodged = true
  787. elseif mainCircularskillshot3(skillshot, heroPosition) then
  788. alreadydodged = true
  789. elseif mainCircularskillshot4(skillshot, heroPosition, moveableDistance, evadeRadius, safeTarget) then
  790. alreadydodged = true
  791. elseif mainCircularskillshot5(skillshot, safeTarget) then
  792. alreadydodged = true
  793. end
  794. end
  795. end
  796.  
  797. function haveShield()
  798. if isSivir and myHero:CanUseSpell(_E) == READY then
  799. return true
  800. end
  801. if isNocturne and myHero:CanUseSpell(_W) == READY then
  802. return true
  803. end
  804. return false
  805. end
  806.  
  807. function FlashTo(x, y)
  808. CastSpell(flashSlot, x, y)
  809. end
  810.  
  811.  
  812. function dodgeLineShot(skillshot)
  813. alreadydodged = false
  814. heroPosition = Point2(myHero.x, myHero.z)
  815. local evadeTo1
  816. local evadeTo2
  817. skillshot.evading = true
  818. skillshotLine = Line2(skillshot.startPosition, skillshot.endPosition)
  819. distanceFromSkillshotPath = skillshotLine:distance(heroPosition)
  820. evadeDistance = skillshot.skillshot.radius + hitboxSize / 2 + GoodEvadeConfig.evadeBuffer + moveBuffer
  821. normalVector = Point2(skillshot.directionVector.y, -skillshot.directionVector.x):normalized()
  822. nessecaryMoveWidth = evadeDistance - distanceFromSkillshotPath
  823. evadeTo1 = heroPosition + normalVector * nessecaryMoveWidth
  824. evadeTo2 = heroPosition - normalVector * nessecaryMoveWidth
  825. if skillshot.skillshot.name == "Crescendo" then
  826. if dodgeCrescendo1(skillshot) then
  827. alreadydodged = true
  828. elseif dodgeCrescendo2(skillshot, evadeTo1, evadeTo2) then
  829. alreadydodged = true
  830. end
  831. end
  832. if not alreadydodged then
  833. if lineSkillshot1(skillshot, heroPosition, skillshotLine, distanceFromSkillshotPath, evadeDistance, normalVector, nessecaryMoveWidth, evadeTo1, evadeTo2)
  834. then alreadydodged = true
  835. elseif lineSkillshot2(skillshot)
  836. then alreadydodged = true
  837. elseif lineSkillshot3(skillshot, evadeTo1, evadeTo2)
  838. then alreadydodged = true
  839. elseif lineSkillshot4(skillshot, evadeTo1, evadeTo2)
  840. then alreadydodged = true
  841. end
  842. end
  843. end
  844.  
  845. function _isDangerSkillshot(skillshot)
  846. if skillshot.skillshot.name == "LeonaZenithBlade"
  847. or skillshot.skillshot.name == "EnchantedArrow"
  848. or skillshot.skillshot.name == "LuxMaliceCannon"
  849. or skillshot.skillshot.name == "SejuaniR"
  850. or skillshot.skillshot.name == "Crescendo"
  851. or skillshot.skillshot.name == "TrueshotBarrage"
  852. or skillshot.skillshot.name == "RocketGrab"
  853. or skillshot.skillshot.name == "DredgeLine"
  854. or skillshot.skillshot.name == "EnchantedArrow"
  855. or skillshot.skillshot.name == "ShadowDash"
  856. or skillshot.skillshot.name == "FizzULT"
  857. or skillshot.skillshot.name == "VarusR"
  858. or skillshot.skillshot.name == "SuperMegaDeathRocket"
  859. or skillshot.skillshot.name == "UFSlash"
  860. or skillshot.skillshot.name == "LeonaSolarFlare"
  861. or skillshot.skillshot.name == "AnnieR"
  862. or skillshot.skillshot.name == "OrianaDetonateCommand"
  863. then
  864. return true
  865. else
  866. return false
  867. end
  868. end
  869.  
  870. function isreallydangerous(skillshot)
  871. if skillshot.skillshot.name == "UFSlash"
  872. or skillshot.skillshot.name == "Crescendo"
  873. or skillshot.skillshot.name == "FizzULT"
  874. or skillshot.skillshot.name == "Enchanted Arrow"
  875. or skillshot.skillshot.name == "AnnieR"
  876. or skillshot.skillshot.name == "OrianaDetonateCommand"
  877. then return true
  878. else
  879. return false
  880. end
  881. end
  882.  
  883. function InsideTheWall(evadeTestPoint)
  884. local heroPosition = Point2(myHero.x, myHero.z)
  885. local dist = evadeTestPoint:distance(heroPosition)
  886. local interval = 50
  887. local nChecks = math.ceil((dist+50)/50)
  888.  
  889. if evadeTestPoint.x == 0 or evadeTestPoint.y == 0 then
  890. return true
  891. end
  892. for k=1, nChecks, 1 do
  893. local checksPos = evadeTestPoint + (evadeTestPoint - heroPosition):normalized()*(interval*k)
  894. if IsWall(D3DXVECTOR3(checksPos.x, myHero.y, checksPos.y)) then
  895. return true
  896. end
  897. end
  898. if IsWall(D3DXVECTOR3(evadeTestPoint.x + 20, myHero.y, evadeTestPoint.y + 20)) then return true end
  899. if IsWall(D3DXVECTOR3(evadeTestPoint.x + 20, myHero.y, evadeTestPoint.y - 20)) then return true end
  900. if IsWall(D3DXVECTOR3(evadeTestPoint.x - 20, myHero.y, evadeTestPoint.y - 20)) then return true end
  901. if IsWall(D3DXVECTOR3(evadeTestPoint.x - 20, myHero.y, evadeTestPoint.y + 20)) then return true end
  902.  
  903. return false
  904. end
  905.  
  906. function findBestDirection(skillshot, referencePoint, possiblePoints)
  907. if not skillshot then return closestPoint end
  908. closestPoint = nil
  909. closestDistance = nil
  910. side1 = getSideOfLine(skillshot.startPosition, skillshot.endPosition, Point2(myHero.x, myHero.z))
  911. for i, point in pairs(possiblePoints) do
  912. if point ~= nil and skillshot ~= nil then
  913. side2 = getSideOfLine(skillshot.startPosition, skillshot.endPosition, point)
  914. distToSkillshot = Line2(skillshot.startPosition, skillshot.endPosition):distance(point)
  915. mindistSkillshot = skillshot.skillshot.radius + hitboxSize / 2 + GoodEvadeConfig.evadeBuffer
  916. distance = point:distance(referencePoint)
  917. if (closestDistance == nil or distance <= closestDistance) and not InsideTheWall(point)
  918. and distToSkillshot > mindistSkillshot and (side1 == side2 or side1 == 0) then
  919. closestDistance = distance
  920. closestPoint = point
  921. end
  922. end
  923. end
  924.  
  925. return closestPoint
  926. end
  927.  
  928. function calculateLongitudinalApproachLength(skillshot, d)
  929. v1 = skillshot.skillshot.projectileSpeed
  930. v2 = myHero.ms
  931. longitudinalDistance = math.max(skillshotPosition(skillshot, GetTickCount()):distance(getPerpendicularFootpoint(skillshot.startPosition, skillshot.endPosition, Point2(myHero.x, myHero.z))) - hitboxSize / 2 - skillshot.skillshot.radius, 0) + v1 * math.max(skillshot.startTick - GetTickCount(), 0) / 1000
  932.  
  933. preResult = -d^2 * v1^4 + d^2 * v2^2 * v1^2 + longitudinalDistance^2 * v2^2 * v1^2
  934. if preResult >= 0 then
  935. result = (math.sqrt(preResult) - longitudinalDistance * v2^2) / (v1^2 - v2^2)
  936. if result >= 0 then
  937. return result
  938. end
  939. end
  940.  
  941. return -1
  942. end
  943.  
  944. function calculateLongitudinalRetreatLength(skillshot, d)
  945. v1 = skillshot.skillshot.projectileSpeed
  946. v2 = myHero.ms
  947. longitudinalDistance = math.max(skillshotPosition(skillshot, GetTickCount()):distance(getPerpendicularFootpoint(skillshot.startPosition, skillshot.endPosition, Point2(myHero.x, myHero.z))) - hitboxSize / 2 - skillshot.skillshot.radius, 0) + v1 * math.max(skillshot.startTick - GetTickCount(), 0) / 1000
  948.  
  949. preResult = -d^2 * v1^4 + d^2 * v2^2 * v1^2 + longitudinalDistance^2 * v2^2 * v1^2
  950. if preResult >= 0 then
  951. result = (math.sqrt(preResult) + longitudinalDistance * v2^2) / (v1^2 - v2^2)
  952. if result >= 0 then
  953. return result
  954. end
  955. end
  956.  
  957. return -1
  958. end
  959.  
  960. function inDangerousArea(skillshot, coordinate)
  961. if skillshot.skillshot.type == "line" then
  962. return inRange(skillshot, coordinate)
  963. and not skillshotHasPassed(skillshot, coordinate)
  964. and Line2(skillshot.startPosition, skillshot.endPosition):distance(coordinate) < (skillshot.skillshot.radius + hitboxSize / 2 + GoodEvadeConfig.evadeBuffer)
  965. and coordinate:distance(skillshot.startPosition + skillshot.directionVector) <= coordinate:distance(skillshot.startPosition - skillshot.directionVector)
  966. else
  967. return coordinate:distance(skillshot.endPosition) <= skillshot.skillshot.radius + hitboxSize / 2 + GoodEvadeConfig.evadeBuffer
  968. end
  969. end
  970.  
  971. function inRange(skillshot, coordinate)
  972. return getPerpendicularFootpoint(skillshot.startPosition, skillshot.endPosition, coordinate):distance(skillshot.startPosition) <= skillshot.skillshot.range
  973. end
  974.  
  975. function OnCreateObj(object)
  976. if object ~= nil and object.type == "obj_GeneralParticleEmmiter" then
  977. for i, skillShotChampion in pairs(champions) do
  978. for i, skillshot in pairs(skillShotChampion.skillshots) do
  979. if GoodEvadeSkillshotConfig[tostring(skillshot.name)] == 2 then
  980. if skillshot.projectileName == object.name then
  981. for i, detectedSkillshot in pairs(detectedSkillshots) do
  982. if detectedSkillshot.skillshot.projectileName == skillshot.projectileName then
  983. return
  984. end
  985. end
  986. for i = 1, heroManager.iCount, 1 do
  987. currentHero = heroManager:GetHero(i)
  988. if currentHero.team == myHero.team and skillShotChampion.charName == currentHero.charName then
  989. return
  990. end
  991. end
  992.  
  993. if GoodEvadeSkillshotConfig[tostring(skillshot.name)] == 2 or (GoodEvadeSkillshotConfig[tostring(skillshot.name)] == 1 and nEnemies <= 2 and not (GoodEvadeConfig.dodgeCConly or GoodEvadeConfig.dodgeCConly2)) then
  994. if skillshot.type == "line" then
  995. skillshotToAdd = {object = object, startPosition = nil, endPosition = nil, directionVector = nil, startTick = GetTickCount(), endTick = GetTickCount() + skillshot.range/skillshot.projectileSpeed*1000, skillshot = skillshot, evading = false, drawit = true, alreadydashed = false}
  996. elseif skillshot.type == "circular" then
  997. endPosition = Point2(object.x, object.z)
  998. startPosition = Point2(object.x, object.z)
  999. table.insert(detectedSkillshots, {startPosition = startPosition, endPosition = endPosition,
  1000. directionVector = (endPosition - startPosition):normalized(), startTick = GetTickCount() + skillshot.spellDelay,
  1001. endTick = GetTickCount() + skillshot.spellDelay + skillshot.projectileSpeed, skillshot = skillshot, evading = false, drawit = false, alreadydashed = false})
  1002. end
  1003. end
  1004. return
  1005. end
  1006. end
  1007. end
  1008. end
  1009. end
  1010. end
  1011. function OnAnimation(unit, animationName)
  1012. if unit.isMe and (animationName == "Idle1" or animationName == "Run") then CastingSpell = false end
  1013. end
  1014.  
  1015. function OnProcessSpell(unit, spell)
  1016. if unit.isMe and myHero.charName == "MasterYi" and spell.name == myHero:GetSpellData(_W).name then
  1017. CastingSpell = true
  1018. elseif unit.isMe and myHero.charName == "Nunu" and spell.name == myHero:GetSpellData(_R).name then
  1019. CastingSpell = true
  1020. elseif unit.isMe and myHero.charName == "MissFortune" and spell.name == myHero:GetSpellData(_R).name then
  1021. CastingSpell = true
  1022. elseif unit.isMe and myHero.charName == "Malzahar" and spell.name == myHero:GetSpellData(_R).name then
  1023. CastingSpell = true
  1024. elseif unit.isMe and myHero.charName == "Katarina" and spell.name == myHero:GetSpellData(_R).name then
  1025. CastingSpell = true
  1026. elseif unit.isMe and myHero.charName == "Janna" and spell.name == myHero:GetSpellData(_R).name then
  1027. CastingSpell = true
  1028. elseif unit.isMe and myHero.charName == "Galio" and spell.name == myHero:GetSpellData(_R).name then
  1029. CastingSpell = true
  1030. elseif unit.isMe and myHero.charName == "FiddleSticks" and spell.name == myHero:GetSpellData(_W).name then
  1031. CastingSpell = true
  1032. elseif unit.isMe and myHero.charName == "FiddleSticks" and spell.name == myHero:GetSpellData(_R).name then
  1033. CastingSpell = true
  1034. end
  1035. if unit.isMe and isLeblanc then
  1036. if spell.name == myHero:GetSpellData(_Q).name then lastspell = "Q"
  1037. elseif spell.name == myHero:GetSpellData(_W).name then lastspell = "W"
  1038. elseif spell.name == myHero:GetSpellData(_E).name then lastspell = "E"
  1039. end
  1040. end
  1041. if not myHero.dead and unit.team ~= myHero.team then
  1042. for i, skillShotChampion in pairs(champions) do
  1043. if skillShotChampion.charName == unit.charName then
  1044. for i, skillshot in pairs(skillShotChampion.skillshots) do
  1045. if skillshot.spellName == spell.name then
  1046. startPosition = Point2(spell.startPos.x, spell.startPos.z)
  1047. endPosition = Point2(spell.endPos.x, spell.endPos.z)
  1048. if isOrianna and unit.charName == "Orianna" then
  1049. ball = nil
  1050. for i = 1, objManager.maxObjects, 1 do
  1051. local obj = objManager:GetObject(i)
  1052. CheckBall(obj)
  1053. end
  1054. if ball ~= nil then
  1055. startPosition = Point2(ball.x, ball.z)
  1056. if skillshot.spellName == "OrianaDetonateCommand" then
  1057. endPosition = Point2(ball.x, ball.z)
  1058. end
  1059. end
  1060. end
  1061. directionVector = (endPosition - startPosition):normalized()
  1062. if isOrianna and unit.charName == "Orianna" then
  1063. if skillshot.spellName == "OrianaIzunaCommand" then skillshot.range = startPosition:distance(endPosition) end
  1064. end
  1065. if GoodEvadeSkillshotConfig[tostring(skillshot.name)] == 2 or (GoodEvadeSkillshotConfig[tostring(skillshot.name)] == 1 and nEnemies <= 2 and not (GoodEvadeConfig.dodgeCConly or GoodEvadeConfig.dodgeCConly2)) then
  1066. if skillshot.type == "line" then
  1067. table.insert(detectedSkillshots, {startPosition = startPosition, endPosition = startPosition + directionVector * skillshot.range,
  1068. directionVector = directionVector, startTick = GetTickCount() + skillshot.spellDelay,
  1069. endTick = GetTickCount() + skillshot.spellDelay + skillshot.range/skillshot.projectileSpeed*1000, skillshot = skillshot, evading = false, drawit = true, alreadydashed = false})
  1070. elseif skillshot.type == "circular" then
  1071. table.insert(detectedSkillshots, {startPosition = startPosition, endPosition = endPosition,
  1072. directionVector = directionVector, startTick = GetTickCount() + skillshot.spellDelay,
  1073. endTick = GetTickCount() + skillshot.spellDelay + skillshot.projectileSpeed, skillshot = skillshot, evading = false, drawit = true, alreadydashed = false})
  1074. else
  1075. local ssrange = endPosition:distance(startPosition)
  1076. table.insert(detectedSkillshots, {startPosition = startPosition, endPosition = endPosition,
  1077. directionVector = directionVector, startTick = GetTickCount() + skillshot.spellDelay,
  1078. endTick = GetTickCount() + skillshot.spellDelay + (skillshot.projectileSpeed * (ssrange/skillshot.range)), skillshot = skillshot, evading = false, drawit = true, alreadydashed = false})
  1079. end
  1080. end
  1081. return
  1082. end
  1083. end
  1084. end
  1085. end
  1086. end
  1087. end
  1088.  
  1089. function skillshotPosition(skillshot, tickCount)
  1090. if skillshot.skillshot.type == "line" then
  1091. return skillshot.startPosition + skillshot.directionVector * math.max(tickCount - skillshot.startTick, 0) * skillshot.skillshot.projectileSpeed / 1000
  1092. else
  1093. return skillshot.endPosition
  1094. end
  1095. end
  1096.  
  1097. function skillshotHasPassed(skillshot, coordinate)
  1098. footOfPerpendicular = getPerpendicularFootpoint(skillshot.startPosition, skillshot.endPosition, coordinate)
  1099. currentSkillshotPosition = skillshotPosition(skillshot, GetTickCount() - 2 * GetLatency())
  1100. side1 = getSideOfLine(coordinate, footOfPerpendicular, currentSkillshotPosition)
  1101. side2 = getSideOfLine(coordinate, footOfPerpendicular, skillshot.startPosition)
  1102. return side1 ~= side2 and currentSkillshotPosition:distance(footOfPerpendicular) >= (skillshot.skillshot.radius + hitboxSize / 2)
  1103. end
  1104.  
  1105. function getPerpendicularFootpoint(linePoint1, linePoint2, point)
  1106. distanceFromLine = Line2(linePoint1, linePoint2):distance(point)
  1107. directionVector = (linePoint2 - linePoint1):normalized()
  1108.  
  1109. footOfPerpendicular = point + Point2(-directionVector.y, directionVector.x) * distanceFromLine
  1110. if Line2(linePoint1, linePoint2):distance(footOfPerpendicular) > distanceFromLine then
  1111. footOfPerpendicular = point - Point2(-directionVector.y, directionVector.x) * distanceFromLine
  1112. end
  1113.  
  1114. return footOfPerpendicular
  1115. end
  1116.  
  1117. function OnTick()
  1118. if GoodEvadeConfig.freemovementblock then
  1119. if evading and not alreadywritten then
  1120. local file = io.open(thatfile, "w")
  1121. file:write("1")
  1122. file:close()
  1123. alreadywritten = true
  1124. elseif not evading and alreadywritten then
  1125. local file = io.open(thatfile, "w")
  1126. file:write("0")
  1127. file:close()
  1128. alreadywritten = false
  1129. end
  1130. if not wrotedisclaimer then
  1131. PrintChat("<font color=\"#FF0000\" >You just enabled free user movement block, this function will only work if you followed tutorial in main thread of the script before allowing it.</font>")
  1132. wrotedisclaimer = true
  1133. end
  1134. end
  1135. if skillshotToAdd ~= nil and skillshotToAdd.object ~= nil and skillshotToAdd.object.valid and (GetTickCount() - skillshotToAdd.startTick) >= GoodEvadeConfig.fowdelay and skillshotToAdd.startPosition == nil then
  1136. skillshotToAdd.startPosition = Point2(skillshotToAdd.object.x, skillshotToAdd.object.z)
  1137. elseif skillshotToAdd ~= nil and skillshotToAdd.object ~= nil and skillshotToAdd.object.valid and (GetTickCount() - skillshotToAdd.startTick) >= (GoodEvadeConfig.fowdelay+1) then
  1138. skillshotToAdd.directionVector = (Point2(skillshotToAdd.object.x, skillshotToAdd.object.z) - skillshotToAdd.startPosition):normalized()
  1139. skillshotToAdd.endPosition = skillshotToAdd.startPosition + skillshotToAdd.directionVector * skillshotToAdd.skillshot.range
  1140. table.insert(detectedSkillshots, skillshotToAdd)
  1141. skillshotToAdd = nil
  1142. end
  1143. if shieldtick ~= nil then
  1144. if GetTickCount() >= shieldtick then
  1145. if haveShield() then
  1146. if isSivir then
  1147. CastSpell(_E)
  1148. elseif isNocturne then
  1149. CastSpell(_W)
  1150. end
  1151. else shieldtick = nil
  1152. end
  1153. end
  1154. end
  1155. if evading then
  1156. for i, detectedSkillshot in pairs(detectedSkillshots) do
  1157. if detectedSkillshot and detectedSkillshot.evading and inDangerousArea(detectedSkillshot, Point2(myHero.x, myHero.z)) then
  1158. dodgeSkillshot(detectedSkillshot)
  1159. end
  1160. end
  1161. end
  1162. if haveflash then
  1163. if myHero:CanUseSpell(flashSlot) == READY then
  1164. flashready = true
  1165. else flashready = false
  1166. end
  1167. end
  1168. if GoodEvadeConfig.resetdodge then
  1169. stopEvade()
  1170. detectedSkillshots = {}
  1171. end
  1172. if AutoCarry ~= nil then
  1173. if AutoCarry.MainMenu ~= nil then
  1174. if AutoCarry.MainMenu.AutoCarry or AutoCarry.MainMenu.LastHit or AutoCarry.MainMenu.MixedMode or AutoCarry.MainMenu.LaneClear
  1175. then
  1176. if not bufferset then
  1177. currentbuffer = GoodEvadeConfig.evadeBuffer
  1178. bufferset = true
  1179. end
  1180. if not VIP_USER then
  1181. if lastset < GetTickCount()
  1182. then lastMovement.destination = Point2(mousePos.x, mousePos.z)
  1183. lastset = GetTickCount() + 100
  1184. end
  1185. end
  1186. if GoodEvadeConfig.evadeBuffer < currentbuffer + 15 then GoodEvadeConfig.evadeBuffer = currentbuffer + 15
  1187. end
  1188. elseif bufferset and GoodEvadeConfig.evadeBuffer > currentbuffer then GoodEvadeConfig.evadeBuffer = currentbuffer
  1189. bufferset = false
  1190. end
  1191. elseif AutoCarry.Keys ~= nil then
  1192. if AutoCarry.Keys.AutoCarry or AutoCarry.Keys.MixedMode or AutoCarry.Keys.LastHit or AutoCarry.Keys.LaneClear then
  1193. if not bufferset then
  1194. currentbuffer = GoodEvadeConfig.evadeBuffer
  1195. bufferset = true
  1196. end
  1197. if not VIP_USER then
  1198. if lastset < GetTickCount()
  1199. then lastMovement.destination = Point2(mousePos.x, mousePos.z)
  1200. lastset = GetTickCount() + 100
  1201. end
  1202. end
  1203. if GoodEvadeConfig.evadeBuffer < currentbuffer + 15 then GoodEvadeConfig.evadeBuffer = currentbuffer + 15
  1204. end
  1205. elseif bufferset and GoodEvadeConfig.evadeBuffer > currentbuffer then GoodEvadeConfig.evadeBuffer = currentbuffer
  1206. bufferset = false
  1207. end
  1208. end
  1209. elseif MMA_Loaded ~= nil then
  1210. if _G.MMA_Orbwalker or _G.MMA_HybridMode or _G.MMA_LaneClear or _G.MMA_LastHit then
  1211. if not bufferset then
  1212. currentbuffer = GoodEvadeConfig.evadeBuffer
  1213. bufferset = true
  1214. end
  1215. if not VIP_USER then
  1216. if lastset < GetTickCount()
  1217. then lastMovement.destination = Point2(mousePos.x, mousePos.z)
  1218. lastset = GetTickCount() + 100
  1219. end
  1220. end
  1221. if GoodEvadeConfig.evadeBuffer < currentbuffer + 15 then GoodEvadeConfig.evadeBuffer = currentbuffer + 15
  1222. end
  1223. elseif bufferset and GoodEvadeConfig.evadeBuffer > currentbuffer then GoodEvadeConfig.evadeBuffer = currentbuffer
  1224. bufferset = false
  1225. end
  1226. end
  1227. nSkillshots = 0
  1228. for _, detectedSkillshot in pairs(detectedSkillshots) do
  1229. if detectedSkillshot then nSkillshots = nSkillshots + 1 end
  1230. end
  1231.  
  1232. if not allowCustomMovement and nSkillshots == 0 then
  1233. stopEvade()
  1234. end
  1235.  
  1236. hitboxSize = GetDistance(myHero.minBBox, myHero.maxBBox)
  1237.  
  1238. nEnemies = CountEnemyHeroInRange(1500)
  1239. table.sort(enemyes, function(x,y) return GetDistance(x) < GetDistance(y) end)
  1240.  
  1241.  
  1242. heroPosition = Point2(myHero.x, myHero.z)
  1243. for i, detectedSkillshot in ipairs(detectedSkillshots) do
  1244. if detectedSkillshot.endTick <= GetTickCount() then
  1245. table.remove(detectedSkillshots, i)
  1246. i = i-1
  1247. if detectedSkillshot.evading then
  1248. continueMovement(detectedSkillshot)
  1249. end
  1250. else
  1251. if evading then
  1252. if detectedSkillshot.evading and not inDangerousArea(detectedSkillshot, heroPosition) then
  1253. if detectedSkillshot.skillshot.type == "line" then
  1254.  
  1255. side1 = getSideOfLine(detectedSkillshot.startPosition, detectedSkillshot.endPosition, heroPosition)
  1256. side2 = getSideOfLine(detectedSkillshot.startPosition, detectedSkillshot.endPosition, getLastMovementDestination())
  1257. if skillshotHasPassed(detectedSkillshot, heroPosition) then
  1258. continueMovement(detectedSkillshot)
  1259.  
  1260. elseif not inDangerousArea(detectedSkillshot, getLastMovementDestination()) and (side1 == side2) and (side1 ~= 0) then
  1261. continueMovement(detectedSkillshot)
  1262.  
  1263. elseif not inRange(detectedSkillshot, heroPosition) and not inRange(detectedSkillshot, getLastMovementDestination()) then
  1264. continueMovement(detectedSkillshot)
  1265.  
  1266. elseif lastMovement.approachedPoint ~= getLastMovementDestination() then
  1267. footpoint = getPerpendicularFootpoint(detectedSkillshot.startPosition, detectedSkillshot.endPosition, getLastMovementDestination())
  1268. closestSafePoint = footpoint + Point2(-detectedSkillshot.directionVector.y, detectedSkillshot.directionVector.x) * (detectedSkillshot.skillshot.radius + hitboxSize / 2 + GoodEvadeConfig.evadeBuffer + moveBuffer)
  1269. if (getSideOfLine(detectedSkillshot.startPosition, detectedSkillshot.endPosition, heroPosition) ~= getSideOfLine(detectedSkillshot.startPosition, detectedSkillshot.endPosition, closestSafePoint)) then
  1270. closestSafePoint = footpoint - Point2(-detectedSkillshot.directionVector.y, detectedSkillshot.directionVector.x) * (detectedSkillshot.skillshot.radius + hitboxSize / 2 + GoodEvadeConfig.evadeBuffer + moveBuffer)
  1271. end
  1272.  
  1273. captureMovements = false
  1274. allowCustomMovement = true
  1275. if skillshot ~= nil then if skillshot.spellName ~= nil then if GoodEvadeSkillshotConfig[tostring(skillshot.name)] == 2 and (nSkillshots > 1) and NeedDash(skillshot, true) then DashTo(closestSafePoint.x, closestSafePoint.y) end end
  1276. myHero:MoveTo(closestSafePoint.x, closestSafePoint.y)
  1277. lastMovement.moveCommand = Point2(closestSafePoint.x, closestSafePoint.y)
  1278. allowCustomMovement = false
  1279. captureMovements = true
  1280.  
  1281. lastMovement.approachedPoint = getLastMovementDestination()
  1282. end
  1283. end
  1284. else
  1285. evadeRadius = detectedSkillshot.skillshot.radius + hitboxSize / 2 + GoodEvadeConfig.evadeBuffer + moveBuffer
  1286. directionVector = (heroPosition - detectedSkillshot.endPosition):normalized()
  1287. tangentDirectionVector = Point2(-directionVector.y, directionVector.x)
  1288. movementTargetSideOfLine = getSideOfLine(heroPosition, heroPosition + tangentDirectionVector, getLastMovementDestination())
  1289. skillshotSideOfLine = getSideOfLine(heroPosition, heroPosition + tangentDirectionVector, detectedSkillshot.endPosition)
  1290.  
  1291. if movementTargetSideOfLine == 0 or movementTargetSideOfLine ~= skillshotSideOfLine then
  1292. continueMovement(detectedSkillshot)
  1293. else
  1294. if getLastMovementDestination():distance(detectedSkillshot.endPosition) <= evadeRadius then
  1295. closestTarget = detectedSkillshot.endPosition + (getLastMovementDestination() - detectedSkillshot.endPosition):normalized() * evadeRadius
  1296. else
  1297. closestTarget = nil
  1298. end
  1299.  
  1300. dx = detectedSkillshot.endPosition.x - heroPosition.x
  1301. dy = detectedSkillshot.endPosition.y - heroPosition.y
  1302. D_squared = dx * dx + dy * dy
  1303. if D_squared < evadeRadius * evadeRadius then
  1304. safePoint1 = heroPosition - tangentDirectionVector * (evadeRadius / 2 + smoothing)
  1305. safePoint2 = heroPosition + tangentDirectionVector * (evadeRadius / 2 + smoothing)
  1306. else
  1307. intersectionPoints = Circle2(detectedSkillshot.endPosition, evadeRadius):intersectionPoints(Circle2(heroPosition, math.sqrt(D_squared - evadeRadius * evadeRadius)))
  1308. if #intersectionPoints == 2 then
  1309. safePoint1 = heroPosition - (heroPosition - intersectionPoints[1]):normalized() * (evadeRadius / 2 + smoothing)
  1310. safePoint2 = heroPosition - (heroPosition - intersectionPoints[2]):normalized() * (evadeRadius / 2 + smoothing)
  1311. else
  1312. safePoint1 = heroPosition - tangentDirectionVector * (evadeRadius / 2 + smoothing)
  1313. safePoint2 = heroPosition + tangentDirectionVector * (evadeRadius / 2 + smoothing)
  1314. end
  1315. end
  1316.  
  1317. local theta = ((-detectedSkillshot.endPosition + safePoint2):polar() - (-detectedSkillshot.endPosition + safePoint1):polar()) % 360
  1318. if closestTarge and (
  1319. (
  1320. theta < 180 and (
  1321. getSideOfLine(detectedSkillshot.endPosition, safePoint2, closestTarget) == getSideOfLine(detectedSkillshot.endPosition, safePoint2, heroPosition) and
  1322. getSideOfLine(detectedSkillshot.endPosition, safePoint1, closestTarget) == getSideOfLine(detectedSkillshot.endPosition, safePoint1, heroPosition)
  1323. )
  1324. ) or (
  1325. theta > 180 and (
  1326. getSideOfLine(detectedSkillshot.endPosition, safePoint2, closestTarget) == getSideOfLine(detectedSkillshot.endPosition, safePoint2, heroPosition) or
  1327. getSideOfLine(detectedSkillshot.endPosition, safePoint1, closestTarget) == getSideOfLine(detectedSkillshot.endPosition, safePoint1, heroPosition)
  1328. )
  1329. )
  1330. ) then
  1331. possibleMovementTargets = {closestTarget, safePoint1, safePoint2}
  1332. else
  1333. possibleMovementTargets = {safePoint1, safePoint2}
  1334. end
  1335.  
  1336. closestPoint = findBestDirection(skillshot,getLastMovementDestination(), possibleMovementTargets)
  1337. if closestPoint ~= nil then
  1338. captureMovements = false
  1339. allowCustomMovement = true
  1340. if skillshot ~= nil then if skillshot.spellName ~= nil then if GoodEvadeSkillshotConfig[tostring(skillshot.name)] == 2 and (nSkillshots > 1) and NeedDash(skillshot, true) then DashTo(closestPoint.x, closestPoint.y) end
  1341. myHero:MoveTo(closestPoint.x, closestPoint.y)
  1342. lastMovement.moveCommand = Point2(closestPoint.x, closestPoint.y)
  1343. allowCustomMovement = false
  1344. captureMovements = true
  1345. end
  1346. end
  1347. end
  1348. end
  1349. end
  1350. end
  1351. elseif inDangerousArea(detectedSkillshot, heroPosition) then
  1352. dodgeSkillshot(detectedSkillshot)
  1353. end
  1354. end
  1355. end
  1356. end
  1357.  
  1358. function DashTo(x, y)
  1359. if GoodEvadeConfig.usedashes then
  1360. if isVayne and myHero:CanUseSpell(_Q) == READY then
  1361. CastSpell(_Q, x, y)
  1362. elseif isRiven and myHero:CanUseSpell(_E) == READY then
  1363. CastSpell(_E, x, y)
  1364. elseif isGraves and myHero:CanUseSpell(_E) == READY then
  1365. CastSpell(_E, x, y)
  1366. elseif isEzreal and myHero:CanUseSpell(_E) == READY then
  1367. CastSpell(_E, x, y)
  1368. elseif isKassadin and myHero:CanUseSpell(_R) == READY then
  1369. CastSpell(_R, x, y)
  1370. elseif isLeblanc and myHero:CanUseSpell(_W) == READY then
  1371. CastSpell(_W, x, y)
  1372. elseif isLeblanc and myHero:CanUseSpell(_R) == READY and lastspell == "W" then
  1373. CastSpell(_R, x, y)
  1374. elseif isFizz and myHero:CanUseSpell(_E) == READY then
  1375. CastSpell(_E, x, y)
  1376. elseif isShaco and myHero:CanUseSpell(_Q) == READY then
  1377. CastSpell(_Q, x, y)
  1378. elseif isCorki and myHero:CanUseSpell(_W) == READY then
  1379. CastSpell(_W, x, y)
  1380. elseif isRenekton and myHero:CanUseSpell(_E) == READY then
  1381. CastSpell(_E, x, y)
  1382. elseif isLucian and myHero:CanUseSpell(_E) == READY then
  1383. CastSpell(_E, x, y)
  1384. elseif haveflash and flashready and useflash and GoodEvadeConfig.useflash then
  1385. CastSpell(flashSlot, x, y)
  1386. useflash = false
  1387. elseif isCaitlyn and myHero:CanUseSpell(_E) == READY then
  1388. myPos = Point2(myHero.x, myHero.z)
  1389. castpos = myPos + (myPos - (Point2(x, y)))
  1390. CastSpell(_E, castpos.x, castpos.y)
  1391. elseif isTristana and myHero:CanUseSpell(_W) == READY then
  1392. CastSpell(_W, x, y)
  1393. elseif isShen and myHero:CanUseSpell(_E) == READY then
  1394. CastSpell(_E, x, y)
  1395. elseif isTryndamere and myHero:CanUseSpell(_E) == READY then
  1396. CastSpell(_E, x, y)
  1397. end
  1398. end
  1399. end
  1400. function NeedDash(skillshot, forceDash)
  1401. if GoodEvadeConfig.usedashes then
  1402. useflash = false
  1403. local hp = myHero.health / myHero.maxHealth
  1404. if isVayne and myHero:CanUseSpell(_Q) == READY and skillshot.skillshot.cc == "true" then
  1405. if forceDash or hp < 0.4 then
  1406. dashrange = 300
  1407. return true end
  1408. if nSkillshots > 1 or _isDangerSkillshot(skillshot) then
  1409. dashrange = 300
  1410. return true end
  1411. elseif isRiven and myHero:CanUseSpell(_E) == READY and skillshot.skillshot.cc == "true" then
  1412. if forceDash or hp < 0.4 then
  1413. dashrange = 325
  1414. return true end
  1415. if nSkillshots > 1 or _isDangerSkillshot(skillshot) then
  1416. dashrange = 325
  1417. return true end
  1418. elseif isGraves and myHero:CanUseSpell(_E) == READY and skillshot.skillshot.cc == "true" then
  1419. if forceDash or hp < 0.4 then
  1420. dashrange = 425
  1421. return true end
  1422. if _isDangerSkillshot(skillshot) then
  1423. dashrange = 425
  1424. return true end
  1425. if _isDangerSkillshot(skillshot) then
  1426. dashrange = 660
  1427. return true end
  1428. elseif isShaco and myHero:CanUseSpell(_Q) == READY and skillshot.skillshot.cc == "true" then
  1429. if skillshot or hp < 0.4 then
  1430. dashrange = 400
  1431. return true end
  1432. if _isDangerSkillshot(skillshot) then
  1433. dashrange = 400
  1434. return true end
  1435. elseif isEzreal and myHero:CanUseSpell(_E) == READY and skillshot.skillshot.cc == "true" then
  1436. if forceDash or hp < 0.4 then
  1437. dashrange = 450
  1438. return true end
  1439. if _isDangerSkillshot(skillshot) then
  1440. dashrange = 450
  1441. return true end
  1442. elseif isFizz and myHero:CanUseSpell(_E) == READY and skillshot.skillshot.cc == "true" then
  1443. if skillshot or hp < 0.4 then
  1444. dashrange = 400
  1445. return true end
  1446. if _isDangerSkillshot(skillshot) then
  1447. dashrange = 400
  1448. return true end
  1449. elseif isKassadin and myHero:CanUseSpell(_R) == READY and skillshot.skillshot.cc == "true" then
  1450. if forceDash or hp < 0.4 then
  1451. dashrange = 700
  1452. return true end
  1453. if _isDangerSkillshot(skillshot) then
  1454. dashrange = 700
  1455. return true end
  1456. elseif isLeblanc and myHero:CanUseSpell(_W) == READY and skillshot.skillshot.cc == "true" then
  1457. if forceDash or hp < 0.4 then
  1458. dashrange = 600
  1459. return true end
  1460. if _isDangerSkillshot(skillshot) then
  1461. dashrange = 600
  1462. return true end
  1463. elseif isLeblanc and myHero:CanUseSpell(_R) == READY and skillshot.skillshot.cc == "true" and lastspell == "W" then
  1464. if forceDash or hp < 0.4 then
  1465. dashrange = 600
  1466. return true end
  1467. if _isDangerSkillshot(skillshot) then
  1468. dashrange = 600
  1469. return true end
  1470. elseif isRenekton and myHero:CanUseSpell(_E) == READY and skillshot.skillshot.cc == "true" then
  1471. if forceDash or hp < 0.4 then
  1472. dashrange = 450
  1473. return true end
  1474. if _isDangerSkillshot(skillshot) then
  1475. dashrange = 450
  1476. return true end
  1477. elseif isCorki and myHero:CanUseSpell(_W) == READY and skillshot.skillshot.cc == "true" then
  1478. if _isDangerSkillshot(skillshot) then
  1479. dashrange = 800
  1480. return true end
  1481. elseif isLucian and myHero:CanUseSpell(_E) == READY and skillshot.skillshot.cc == "true" then
  1482. if forceDash or hp < 0.4 then
  1483. dashrange = 425
  1484. return true end
  1485. if _isDangerSkillshot(skillshot) then
  1486. dashrange = 425
  1487. return true end
  1488. elseif haveflash and flashready and GoodEvadeConfig.useflash and isreallydangerous(skillshot) then
  1489. dashrange = 400
  1490. useflash = true
  1491. return true
  1492. elseif isTryndamere and myHero:CanUseSpell(_E) == READY and skillshot.skillshot.cc == "true" then
  1493. if forceDash or hp < 0.4 then
  1494. dashrange = 660
  1495. return true end
  1496. elseif isCaitlyn and myHero:CanUseSpell(_E) == READY and skillshot.skillshot.cc == "true" then
  1497. if forceDash or hp < 0.4 then
  1498. dashrange = 400
  1499. return true end
  1500. elseif isTristana and myHero:CanUseSpell(_W) == READY and skillshot.skillshot.cc == "true" then
  1501. if _isDangerSkillshot(skillshot) then
  1502. dashrange = 900
  1503. return true end
  1504. elseif isShen and myHero:CanUseSpell(_E) == READY and skillshot.skillshot.cc == "true" then
  1505. if forceDash or hp < 0.4 then
  1506. dashrange = 600
  1507. return true end
  1508. if _isDangerSkillshot(skillshot) then
  1509. dashrange = 600
  1510. return true end
  1511. end
  1512. return false
  1513. end
  1514. end
  1515.  
  1516. function evadeTo(x, y, forceDash)
  1517. startEvade()
  1518. evadePoint = Point2(x, y)
  1519. allowCustomMovement = true
  1520. captureMovements = false
  1521. if forceDash then
  1522. local evadePos = Point2(x, y)
  1523. local myPos = Point2(myHero.x, myHero.z)
  1524. local ourdistance = evadePos:distance(myPos)
  1525. local dashPos = myPos - (myPos - evadePos):normalized() * dashrange
  1526. DashTo(dashPos.x, dashPos.y)
  1527. end
  1528. myHero:MoveTo(x, y)
  1529. lastMovement.moveCommand = Point2(x, y)
  1530. captureMovements = true
  1531. allowCustomMovement = false
  1532. evading = true
  1533. evadingTick = GetTickCount()
  1534. end
  1535.  
  1536. function continueMovement(skillshot)
  1537. if VIP_USER then
  1538. if evading then
  1539. skillshot.evading = false
  1540. lastMovement.approachedPoint = nil
  1541.  
  1542. stopEvade()
  1543.  
  1544. if lastMovement.type == 2 then
  1545. captureMovements = false
  1546. myHero:MoveTo(getLastMovementDestination().x, getLastMovementDestination().y)
  1547. captureMovements = true
  1548. elseif lastMovement.type == 3 then
  1549. target = getTarget(lastMovement.targetId)
  1550.  
  1551. if _isValidTarget(target) then
  1552. captureMovements = false
  1553. myHero:Attack(target)
  1554. captureMovements = true
  1555. else
  1556. captureMovements = false
  1557. myHero:MoveTo(myHero.x, myHero.z)
  1558. captureMovements = true
  1559. end
  1560. elseif lastMovement.type == 10 then
  1561. myHero:HoldPosition()
  1562. elseif lastMovement.type == 7 then
  1563. lastMovement.type = 3
  1564. end
  1565. end
  1566. elseif evading then
  1567. skillshot.evading = false
  1568. lastMovement.approachedPoint = nil
  1569. stopEvade()
  1570. if continuetarget == nil then
  1571. captureMovements = false
  1572. myHero:MoveTo(getLastMovementDestination().x, getLastMovementDestination().y)
  1573. captureMovements = true
  1574. elseif continuetarget ~= nil then
  1575. target = continuetarget
  1576. if _isValidTarget(target) then
  1577. captureMovements = false
  1578. myHero:Attack(target)
  1579. captureMovements = true
  1580. else
  1581. captureMovements = false
  1582. myHero:MoveTo(myHero.x, myHero.z)
  1583. captureMovements = true
  1584. end
  1585. end
  1586. end
  1587. end
  1588.  
  1589. function drawLineshit(point1, point2, color, width)
  1590. x1, y1, onScreen1 = get2DFrom3D(point1.x, myHero.y, point1.y)
  1591. x2, y2, onScreen2 = get2DFrom3D(point2.x, myHero.y, point2.y)
  1592.  
  1593. DrawLine(x1, y1, x2, y2, width, color)
  1594. end
  1595. function OnDraw()
  1596. if GoodEvadeConfig.drawEnabled then
  1597. for i, detectedSkillshot in pairs(detectedSkillshots) do
  1598. skillshotPos = skillshotPosition(detectedSkillshot, GetTickCount())
  1599. if detectedSkillshot.drawit == true then
  1600. if detectedSkillshot.skillshot.type == "line" then
  1601. drawLineshit(detectedSkillshot.startPosition, detectedSkillshot.endPosition, 0xFFFF0000, 3)
  1602. DrawCircle(skillshotPos.x, myHero.y, skillshotPos.y, detectedSkillshot.skillshot.radius, 0xFFFFFF)
  1603. else
  1604. DrawCircle(skillshotPos.x, myHero.y, skillshotPos.y, detectedSkillshot.skillshot.radius, 0x00FF00)
  1605. end
  1606. end
  1607. end
  1608. end
  1609. end
  1610.  
  1611. function _isValidTarget(target)
  1612. return target ~= nil and target.valid and target.dead == false and target.bTargetable and target.bMagicImunebMagicImune ~= true and target.bInvulnerable ~= true and target.visible
  1613. end
  1614.  
  1615. function startEvade()
  1616. allowCustomMovement = false
  1617. if AutoCarry
  1618. then if AutoCarry.MainMenu ~= nil then
  1619. if AutoCarry.CanAttack ~= nil then
  1620. _G.AutoCarry.CanAttack = false
  1621. _G.AutoCarry.CanMove = false
  1622. end
  1623. elseif AutoCarry.Keys ~= nil then
  1624. if AutoCarry.MyHero ~= nil then
  1625. _G.AutoCarry.MyHero:MovementEnabled(false)
  1626. _G.AutoCarry.MyHero:AttacksEnabled(false)
  1627. end
  1628. end
  1629. elseif MMA_Loaded then
  1630. _G.MMA_AttackAvailable = false
  1631. _G.MMA_AbleToMove = false
  1632. end
  1633. _G.evade = true
  1634. evading = true
  1635. end
  1636.  
  1637. function stopEvade()
  1638. allowCustomMovement = true
  1639. if AutoCarry then if AutoCarry.MainMenu ~= nil then
  1640. if AutoCarry.CanAttack ~= nil then
  1641. _G.AutoCarry.CanAttack = true
  1642. _G.AutoCarry.CanMove = true
  1643. end
  1644. elseif AutoCarry.Keys ~= nil then
  1645. if AutoCarry.MyHero ~= nil then
  1646. _G.AutoCarry.MyHero:MovementEnabled(true)
  1647. _G.AutoCarry.MyHero:AttacksEnabled(true)
  1648. end
  1649. end
  1650. elseif MMA_Loaded then
  1651. _G.MMA_AttackAvailable = true
  1652. _G.MMA_AbleToMove = true
  1653. end
  1654. _G.evade = false
  1655. evading = false
  1656. end
  1657.  
  1658. function OnWndMsg(msg, key)
  1659. if not VIP_USER then
  1660. if msg == WM_RBUTTONDOWN then
  1661. if evading then
  1662. for i, detectedSkillshot in pairs(detectedSkillshots) do
  1663. if detectedSkillshot and detectedSkillshot.evading and inDangerousArea(detectedSkillshot, Point2(myHero.x, myHero.z)) then
  1664. dodgeSkillshot(detectedSkillshot)
  1665. end
  1666. end
  1667. end
  1668. lastMovement.destination = Point2(mousePos.x, mousePos.z)
  1669. end
  1670. end
  1671. end
  1672. -- beggining of circular skillshot dodging functions --
  1673. function mainCircularskillshot5(skillshot, safeTarget)
  1674. if NeedDash(skillshot, true) and not skillshot.alreadydashed then
  1675. evadeTo(safeTarget.x, safeTarget.y, true)
  1676. skillshot.alreadydashed = true
  1677. return true
  1678. else return false
  1679. end
  1680. return false
  1681. end
  1682.  
  1683. function mainCircularskillshot4(skillshot, heroPosition, moveableDistance, evadeRadius, safeTarget)
  1684. if NeedDash(skillshot, true) and not skillshot.alreadydashed then
  1685. moveableDistance = (myHero.ms * math.max(skillshot.endTick - GetTickCount() - GetLatency()/2, 0) / 1000) + dashrange
  1686. evadeRadius = skillshot.skillshot.radius + hitboxSize / 2 + GoodEvadeConfig.evadeBuffer + moveBuffer
  1687.  
  1688. safeTarget = skillshot.endPosition + (heroPosition - skillshot.endPosition):normalized() * evadeRadius
  1689. if getLastMovementDestination():distance(skillshot.endPosition) <= evadeRadius then
  1690. closestTarget = skillshot.endPosition + (getLastMovementDestination() - skillshot.endPosition):normalized() * evadeRadius
  1691. else
  1692. closestTarget = nil
  1693. end
  1694.  
  1695. lineDistance = Line2(heroPosition, getLastMovementDestination()):distance(skillshot.endPosition)
  1696. directionTarget = heroPosition + (getLastMovementDestination() - heroPosition):normalized() * (math.sqrt(heroPosition:distance(skillshot.endPosition)^2 - lineDistance^2) + math.sqrt(evadeRadius^2 - lineDistance^2))
  1697. if directionTarget:distance(skillshot.endPosition) >= evadeRadius + 1 then
  1698. directionTarget = heroPosition + (getLastMovementDestination() - heroPosition):normalized() * (math.sqrt(evadeRadius^2 - lineDistance^2) - math.sqrt(heroPosition:distance(skillshot.endPosition)^2 - lineDistance^2))
  1699. end
  1700.  
  1701. possibleMovementTargets = {}
  1702. intersectionPoints = Circle2(skillshot.endPosition, evadeRadius):intersectionPoints(Circle2(heroPosition, moveableDistance))
  1703. if #intersectionPoints == 2 then
  1704. leftTarget = intersectionPoints[1]
  1705. rightTarget = intersectionPoints[2]
  1706.  
  1707. local theta = ((-skillshot.endPosition + leftTarget):polar() - (-skillshot.endPosition + rightTarget):polar()) % 360
  1708. if ((theta >= 180 and getSideOfLine(skillshot.endPosition, leftTarget, directionTarget) == getSideOfLine(skillshot.endPosition, leftTarget, heroPosition) and getSideOfLine(skillshot.endPosition, rightTarget, directionTarget) == getSideOfLine(skillshot.endPosition, rightTarget, heroPosition)) or (theta <= 180 and (getSideOfLine(skillshot.endPosition, leftTarget, directionTarget) == getSideOfLine(skillshot.endPosition, leftTarget, heroPosition) or getSideOfLine(skillshot.endPosition, rightTarget, directionTarget) == getSideOfLine(skillshot.endPosition, rightTarget, heroPosition)))) then
  1709. table.insert(possibleMovementTargets, directionTarget)
  1710. end
  1711.  
  1712. if closestTarget ~= nil and ((theta >= 180 and getSideOfLine(skillshot.endPosition, leftTarget, closestTarget) == getSideOfLine(skillshot.endPosition, leftTarget, heroPosition) and getSideOfLine(skillshot.endPosition, rightTarget, closestTarget) == getSideOfLine(skillshot.endPosition, rightTarget, heroPosition)) or (theta <= 180 and (getSideOfLine(skillshot.endPosition, leftTarget, closestTarget) == getSideOfLine(skillshot.endPosition, leftTarget, heroPosition) or getSideOfLine(skillshot.endPosition, rightTarget, closestTarget) == getSideOfLine(skillshot.endPosition, rightTarget, heroPosition)))) then
  1713. table.insert(possibleMovementTargets, closestTarget)
  1714. end
  1715.  
  1716.  
  1717. table.insert(possibleMovementTargets, safeTarget)
  1718. table.insert(possibleMovementTargets, leftTarget)
  1719. table.insert(possibleMovementTargets, rightTarget)
  1720. else
  1721. if skillshot.skillshot.radius <= moveableDistance then
  1722. table.insert(possibleMovementTargets, closestTarget)
  1723. table.insert(possibleMovementTargets, directionTarget)
  1724. table.insert(possibleMovementTargets, safeTarget)
  1725. end
  1726. end
  1727.  
  1728. closestPoint = findBestDirection(skillshot, getLastMovementDestination(), possibleMovementTargets)
  1729. if closestPoint ~= nil then
  1730. closestPoint = closestPoint + (closestPoint - heroPosition):normalized() * smoothing
  1731. evadeTo(closestPoint.x, closestPoint.y, true)
  1732. skillshot.alreadydashed = true
  1733. return true
  1734. else return false
  1735. end
  1736. else return false
  1737. end
  1738. return false
  1739. end
  1740.  
  1741. function mainCircularskillshot3(skillshot, heroPosition)
  1742. if getLastMovementDestination():distance(heroPosition) > 20 and NeedDash(skillshot, true) and not skillshot.alreadydashed then
  1743. dashpos = getLastMovementDestination() + (getLastMovementDestination() - heroPosition):normalized() * dashrange
  1744. if dashpos:distance(skillshot.endPosition) > skillshot.skillshot.radius and not InsideTheWall(dashpos) then
  1745. evadeTo(dashpos.x, dashpos.y, true)
  1746. skillshot.alreadydashed = true
  1747. return true
  1748. else return false
  1749. end
  1750. else return false
  1751. end
  1752. return false
  1753. end
  1754.  
  1755. function mainCircularskillshot2(skillshot)
  1756. if haveShield() then
  1757. for i, detectedSkillshot in ipairs(detectedSkillshots) do
  1758. if detectedSkillshot.skillshot.name == skillshot.skillshot.name then
  1759. table.remove(detectedSkillshots, i)
  1760. i = i-1
  1761. if detectedSkillshot.evading then
  1762. continueMovement(detectedSkillshot)
  1763. end
  1764. end
  1765. end
  1766. if skillshot.skillshot.shieldnow == "true" then
  1767. if isSivir then
  1768. CastSpell(_E)
  1769. elseif isNocturne then
  1770. CastSpell(_W)
  1771. end
  1772. return true
  1773. elseif skillshot.skillshot.shieldnow == "false" then
  1774. shieldtick = skillshot.endTick - 50 - GetLatency()
  1775. return true
  1776. end
  1777. else return false
  1778. end
  1779. return false
  1780. end
  1781.  
  1782. function mainCircularskillshot1(skillshot, heroPosition, moveableDistance, evadeRadius, safeTarget)
  1783. if getLastMovementDestination():distance(skillshot.endPosition) <= evadeRadius then
  1784. closestTarget = skillshot.endPosition + (getLastMovementDestination() - skillshot.endPosition):normalized() * evadeRadius
  1785. else
  1786. closestTarget = nil
  1787. end
  1788.  
  1789. lineDistance = Line2(heroPosition, getLastMovementDestination()):distance(skillshot.endPosition)
  1790. directionTarget = heroPosition + (getLastMovementDestination() - heroPosition):normalized() * (math.sqrt(heroPosition:distance(skillshot.endPosition)^2 - lineDistance^2) + math.sqrt(evadeRadius^2 - lineDistance^2))
  1791. if directionTarget:distance(skillshot.endPosition) >= evadeRadius + 1 then
  1792. directionTarget = heroPosition + (getLastMovementDestination() - heroPosition):normalized() * (math.sqrt(evadeRadius^2 - lineDistance^2) - math.sqrt(heroPosition:distance(skillshot.endPosition)^2 - lineDistance^2))
  1793. end
  1794.  
  1795. possibleMovementTargets = {}
  1796. intersectionPoints = Circle2(skillshot.endPosition, evadeRadius):intersectionPoints(Circle2(heroPosition, moveableDistance))
  1797. if #intersectionPoints == 2 then
  1798. leftTarget = intersectionPoints[1]
  1799. rightTarget = intersectionPoints[2]
  1800.  
  1801. local theta = ((-skillshot.endPosition + leftTarget):polar() - (-skillshot.endPosition + rightTarget):polar()) % 360
  1802. if ((theta >= 180 and getSideOfLine(skillshot.endPosition, leftTarget, directionTarget) == getSideOfLine(skillshot.endPosition, leftTarget, heroPosition) and getSideOfLine(skillshot.endPosition, rightTarget, directionTarget) == getSideOfLine(skillshot.endPosition, rightTarget, heroPosition)) or (theta <= 180 and (getSideOfLine(skillshot.endPosition, leftTarget, directionTarget) == getSideOfLine(skillshot.endPosition, leftTarget, heroPosition) or getSideOfLine(skillshot.endPosition, rightTarget, directionTarget) == getSideOfLine(skillshot.endPosition, rightTarget, heroPosition)))) then
  1803. table.insert(possibleMovementTargets, directionTarget)
  1804. end
  1805.  
  1806. if closestTarget ~= nil and ((theta >= 180 and getSideOfLine(skillshot.endPosition, leftTarget, closestTarget) == getSideOfLine(skillshot.endPosition, leftTarget, heroPosition) and getSideOfLine(skillshot.endPosition, rightTarget, closestTarget) == getSideOfLine(skillshot.endPosition, rightTarget, heroPosition)) or (theta <= 180 and (getSideOfLine(skillshot.endPosition, leftTarget, closestTarget) == getSideOfLine(skillshot.endPosition, leftTarget, heroPosition) or getSideOfLine(skillshot.endPosition, rightTarget, closestTarget) == getSideOfLine(skillshot.endPosition, rightTarget, heroPosition)))) then
  1807. table.insert(possibleMovementTargets, closestTarget)
  1808. end
  1809.  
  1810.  
  1811. table.insert(possibleMovementTargets, safeTarget)
  1812. table.insert(possibleMovementTargets, leftTarget)
  1813. table.insert(possibleMovementTargets, rightTarget)
  1814. else
  1815. if skillshot.skillshot.radius <= moveableDistance then
  1816. table.insert(possibleMovementTargets, closestTarget)
  1817. table.insert(possibleMovementTargets, directionTarget)
  1818. table.insert(possibleMovementTargets, safeTarget)
  1819. end
  1820. end
  1821.  
  1822. closestPoint = findBestDirection(skillshot, getLastMovementDestination(), possibleMovementTargets)
  1823. if closestPoint ~= nil then
  1824. closestPoint = closestPoint + (closestPoint - heroPosition):normalized() * smoothing
  1825. evadeTo(closestPoint.x, closestPoint.y)
  1826. return true
  1827. else return false
  1828. end
  1829. return false
  1830. end
  1831.  
  1832. function AM1(skillshot)
  1833. if haveShield() then
  1834. for i, detectedSkillshot in ipairs(detectedSkillshots) do
  1835. if detectedSkillshot.skillshot.name == skillshot.skillshot.name then
  1836. table.remove(detectedSkillshots, i)
  1837. i = i-1
  1838. if detectedSkillshot.evading then
  1839. continueMovement(detectedSkillshot)
  1840. end
  1841. end
  1842. end
  1843. if isSivir then
  1844. CastSpell(_E)
  1845. elseif isNocturne then
  1846. CastSpell(_W)
  1847. end
  1848. return true
  1849. else return false
  1850. end
  1851. return false
  1852. end
  1853.  
  1854. function AM2(skillshot, heroPosition)
  1855. if flashready and getLastMovementDestination():distance(heroPosition) > 20 and not skillshot.alreadydashed then
  1856. dashpos = getLastMovementDestination() + (getLastMovementDestination() - heroPosition):normalized() * 400
  1857. if dashpos:distance(skillshot.endPosition) > skillshot.skillshot.radius and not InsideTheWall(dashpos) then
  1858. FlashTo(dashpos.x, dashpos.y)
  1859. skillshot.alreadydashed = true
  1860. for i, detectedSkillshot in ipairs(detectedSkillshots) do
  1861. if detectedSkillshot.skillshot.name == skillshot.skillshot.name then
  1862. table.remove(detectedSkillshots, i)
  1863. i = i-1
  1864. if detectedSkillshot.evading then
  1865. continueMovement(detectedSkillshot)
  1866. end
  1867. end
  1868. end
  1869. return true
  1870. else return false
  1871. end
  1872. else return false
  1873. end
  1874. return false
  1875. end
  1876.  
  1877. function AM3(skillshot, safeTarget)
  1878. if flashready and not skillshot.alreadydashed then
  1879. FlashTo(safeTarget.x, safeTarget.y)
  1880. skillshot.alreadydashed = true
  1881. for i, detectedSkillshot in ipairs(detectedSkillshots) do
  1882. if detectedSkillshot.skillshot.name == skillshot.skillshot.name then
  1883. table.remove(detectedSkillshots, i)
  1884. i = i-1
  1885. if detectedSkillshot.evading then
  1886. continueMovement(detectedSkillshot)
  1887. end
  1888. end
  1889. end
  1890. return true
  1891. else return false
  1892. end
  1893. return false
  1894. end
  1895. -- end of circular skillshot dodging functions --
  1896. -- beggining of line skillshot dodging functions --
  1897. function lineSkillshot1(skillshot, heroPosition, skillshotLine, distanceFromSkillshotPath, evadeDistance, normalVector, nessecaryMoveWidth, evadeTo1, evadeTo2)
  1898. if skillshotLine:distance(evadeTo1) >= skillshotLine:distance(evadeTo2) then
  1899. longitudinalApproachLength = calculateLongitudinalApproachLength(skillshot, nessecaryMoveWidth)
  1900. if longitudinalApproachLength >= 0 then
  1901. evadeToTarget1 = evadeTo1 - skillshot.directionVector * longitudinalApproachLength
  1902. end
  1903.  
  1904. longitudinalApproachLength = calculateLongitudinalApproachLength(skillshot, evadeDistance + distanceFromSkillshotPath)
  1905. if longitudinalApproachLength >= 0 then
  1906. evadeToTarget2 = heroPosition - normalVector * (evadeDistance + distanceFromSkillshotPath) - skillshot.directionVector * longitudinalApproachLength
  1907. end
  1908.  
  1909. longitudinalRetreatLength = calculateLongitudinalRetreatLength(skillshot, nessecaryMoveWidth)
  1910. if longitudinalRetreatLength >= 0 then
  1911. evadeToTarget3 = evadeTo1 + skillshot.directionVector * longitudinalRetreatLength
  1912. end
  1913.  
  1914. longitudinalRetreatLength = calculateLongitudinalRetreatLength(skillshot, evadeDistance + distanceFromSkillshotPath)
  1915. if longitudinalRetreatLength >= 0 then
  1916. evadeToTarget4 = heroPosition - normalVector * (evadeDistance + distanceFromSkillshotPath) + skillshot.directionVector * longitudinalRetreatLength
  1917. end
  1918.  
  1919. safeTarget = evadeTo1
  1920.  
  1921. closestPoint = getLastMovementDestination() + normalVector * (evadeDistance - skillshotLine:distance(getLastMovementDestination()))
  1922. closestPoint2 = getPerpendicularFootpoint(skillshot.startPosition, skillshot.endPosition, getLastMovementDestination()) + normalVector * evadeDistance
  1923. else
  1924. longitudinalApproachLength = calculateLongitudinalApproachLength(skillshot, nessecaryMoveWidth)
  1925. if longitudinalApproachLength >= 0 then
  1926. evadeToTarget1 = evadeTo2 - skillshot.directionVector * longitudinalApproachLength
  1927. end
  1928.  
  1929. longitudinalApproachLength = calculateLongitudinalApproachLength(skillshot, evadeDistance + distanceFromSkillshotPath)
  1930. if longitudinalApproachLength >= 0 then
  1931. evadeToTarget2 = heroPosition + normalVector * (evadeDistance + distanceFromSkillshotPath) - skillshot.directionVector * longitudinalApproachLength
  1932. end
  1933.  
  1934. longitudinalRetreatLength = calculateLongitudinalRetreatLength(skillshot, nessecaryMoveWidth)
  1935. if longitudinalRetreatLength >= 0 then
  1936. evadeToTarget3 = evadeTo2 + skillshot.directionVector * longitudinalRetreatLength
  1937. end
  1938.  
  1939. longitudinalRetreatLength = calculateLongitudinalRetreatLength(skillshot, evadeDistance + distanceFromSkillshotPath)
  1940. if longitudinalRetreatLength >= 0 then
  1941. evadeToTarget4 = heroPosition + normalVector * (evadeDistance + distanceFromSkillshotPath) + skillshot.directionVector * longitudinalRetreatLength
  1942. end
  1943.  
  1944. safeTarget = evadeTo2
  1945.  
  1946. closestPoint = getLastMovementDestination() - normalVector * (evadeDistance - skillshotLine:distance(getLastMovementDestination()))
  1947. closestPoint2 = getPerpendicularFootpoint(skillshot.startPosition, skillshot.endPosition, getLastMovementDestination()) - normalVector * evadeDistance
  1948. end
  1949.  
  1950. if skillshotLine:distance(getLastMovementDestination()) <= evadeDistance then
  1951. directionTarget = findBestDirection(skillshot,getLastMovementDestination(), {closestPoint, closestPoint2, getPerpendicularFootpoint(skillshot.startPosition, skillshot.endPosition, getLastMovementDestination()) - normalVector * evadeDistance, getPerpendicularFootpoint(skillshot.startPosition, skillshot.endPosition, getLastMovementDestination()) + normalVector * evadeDistance})
  1952. else
  1953. if getSideOfLine(skillshot.startPosition, skillshot.endPosition, getLastMovementDestination()) == getSideOfLine(skillshot.startPosition, skillshot.endPosition, heroPosition) then
  1954. if skillshotLine:distance(heroPosition) <= skillshotLine:distance(getLastMovementDestination()) then
  1955. directionTarget = heroPosition + (getLastMovementDestination()-heroPosition):normalized() * ((evadeDistance - distanceFromSkillshotPath) * heroPosition:distance(getLastMovementDestination())) / (skillshotLine:distance(getLastMovementDestination()) - distanceFromSkillshotPath)
  1956. else
  1957. directionTarget = heroPosition + (getLastMovementDestination()-heroPosition):normalized() * ((evadeDistance + distanceFromSkillshotPath) * heroPosition:distance(getLastMovementDestination())) / (distanceFromSkillshotPath - skillshotLine:distance(getLastMovementDestination()))
  1958. end
  1959. else
  1960. directionTarget = heroPosition + (getLastMovementDestination() - heroPosition):normalized() * (evadeDistance + distanceFromSkillshotPath) * heroPosition:distance(getLastMovementDestination()) / (skillshotLine:distance(getLastMovementDestination()) + distanceFromSkillshotPath)
  1961. end
  1962. end
  1963.  
  1964. evadeTarget = nil
  1965. if (evadeToTarget1 ~= nil and evadeToTarget3 ~= nil and Line2(evadeToTarget1, evadeToTarget3):distance(directionTarget) <= 1 and getSideOfLine(evadeToTarget1, getPerpendicularFootpoint(skillshot.startPosition, skillshot.endPosition, evadeToTarget1), directionTarget) ~= getSideOfLine(evadeToTarget3, getPerpendicularFootpoint(skillshot.startPosition, skillshot.endPosition, evadeToTarget3), directionTarget)) or (evadeToTarget2 ~= nil and evadeToTarget4 ~= nil and Line2(evadeToTarget2, evadeToTarget4):distance(directionTarget) <= 1 and getSideOfLine(evadeToTarget2, getPerpendicularFootpoint(skillshot.startPosition, skillshot.endPosition, evadeToTarget2), directionTarget) ~= getSideOfLine(evadeToTarget4, getPerpendicularFootpoint(skillshot.startPosition, skillshot.endPosition, evadeToTarget4), directionTarget)) or (evadeToTarget1 ~= nil and evadeToTarget3 == nil and getSideOfLine(heroPosition, evadeToTarget1, skillshot.startPosition) ~= getSideOfLine(heroPosition, evadeToTarget1, directionTarget)) or (evadeToTarget2 ~= nil and evadeToTarget4 == nil and getSideOfLine(heroPosition, evadeToTarget2, skillshot.startPosition) ~= getSideOfLine(heroPosition, evadeToTarget2, directionTarget)) then
  1966. evadeTarget = directionTarget
  1967. else
  1968. possibleMovementTargets = {}
  1969.  
  1970. if (evadeToTarget1 ~= nil and evadeToTarget3 ~= nil and Line2(evadeToTarget1, evadeToTarget3):distance(closestPoint2) <= 1 and getSideOfLine(evadeToTarget1, getPerpendicularFootpoint(skillshot.startPosition, skillshot.endPosition, evadeToTarget1), closestPoint2) ~= getSideOfLine(evadeToTarget3, getPerpendicularFootpoint(skillshot.startPosition, skillshot.endPosition, evadeToTarget3), closestPoint2)) or (evadeToTarget2 ~= nil and evadeToTarget4 ~= nil and Line2(evadeToTarget2, evadeToTarget4):distance(closestPoint2) <= 1 and getSideOfLine(evadeToTarget2, getPerpendicularFootpoint(skillshot.startPosition, skillshot.endPosition, evadeToTarget2), closestPoint2) ~= getSideOfLine(evadeToTarget4, getPerpendicularFootpoint(skillshot.startPosition, skillshot.endPosition, evadeToTarget4), closestPoint2)) or (evadeToTarget1 ~= nil and evadeToTarget3 == nil and getSideOfLine(heroPosition, evadeToTarget1, skillshot.startPosition) ~= getSideOfLine(heroPosition, evadeToTarget1, closestPoint2)) or (evadeToTarget2 ~= nil and evadeToTarget4 == nil and getSideOfLine(heroPosition, evadeToTarget2, skillshot.startPosition) ~= getSideOfLine(heroPosition, evadeToTarget2, closestPoint2)) then
  1971. table.insert(possibleMovementTargets, closestPoint2)
  1972. end
  1973.  
  1974. if evadeToTarget1 ~= nil then
  1975. table.insert(possibleMovementTargets, evadeToTarget1)
  1976. end
  1977.  
  1978. if evadeToTarget2 ~= nil then
  1979. table.insert(possibleMovementTargets, evadeToTarget2)
  1980. end
  1981.  
  1982. if evadeToTarget3 ~= nil then
  1983. table.insert(possibleMovementTargets, evadeToTarget3)
  1984. end
  1985.  
  1986. if evadeToTarget4 ~= nil then
  1987. table.insert(possibleMovementTargets, evadeToTarget4)
  1988. end
  1989.  
  1990. evadeTarget = findBestDirection(skillshot,getLastMovementDestination(), possibleMovementTargets)
  1991. end
  1992.  
  1993. if evadeTarget then
  1994. if getSideOfLine(skillshot.startPosition, skillshot.endPosition, evadeTarget) == getSideOfLine(skillshot.startPosition, skillshot.endPosition, getLastMovementDestination()) and skillshotLine:distance(getLastMovementDestination()) > evadeDistance then
  1995. pathDirectionVector = (evadeTarget - heroPosition)
  1996. if getSideOfLine(skillshot.startPosition, skillshot.endPosition, heroPosition) == getSideOfLine(skillshot.startPosition, skillshot.endPosition, evadeTarget) then
  1997. evadeTarget = evadeTarget + pathDirectionVector:normalized() * (pathDirectionVector:len() + smoothing / (evadeDistance - distanceFromSkillshotPath) * pathDirectionVector:len())
  1998. else
  1999. evadeTarget = evadeTarget + pathDirectionVector:normalized() * (pathDirectionVector:len() + smoothing / (evadeDistance + distanceFromSkillshotPath) * pathDirectionVector:len())
  2000. end
  2001. end
  2002. evadeTo(evadeTarget.x, evadeTarget.y)
  2003. return true
  2004. else return false
  2005. end
  2006. return false
  2007. end
  2008.  
  2009. function lineSkillshot2(skillshot)
  2010. if haveShield() then
  2011. for i, detectedSkillshot in ipairs(detectedSkillshots) do
  2012. if detectedSkillshot.skillshot.name == skillshot.skillshot.name then
  2013. table.remove(detectedSkillshots, i)
  2014. i = i-1
  2015. if detectedSkillshot.evading then
  2016. continueMovement(detectedSkillshot)
  2017. end
  2018. end
  2019. end
  2020. if isSivir then
  2021. CastSpell(_E)
  2022. elseif isNocturne then
  2023. CastSpell(_W)
  2024. end
  2025. return true
  2026. else return false
  2027. end
  2028. return false
  2029. end
  2030.  
  2031. function lineSkillshot3(skillshot, evadeTo1, evadeTo2)
  2032. if not skillshot.alreadydashed then
  2033. local safeTarget = nil
  2034. if NeedDash(skillshot, true)
  2035. then if (evadeTo1:distance(lastMovement.destination) > evadeTo2:distance(lastMovement.destination)) and not InsideTheWall(evadeTo2) then
  2036. safeTarget = evadeTo2
  2037. elseif (evadeTo2:distance(lastMovement.destination) > evadeTo1:distance(lastMovement.destination)) and not InsideTheWall(evadeTo1) then
  2038. safeTarget = evadeTo1
  2039. elseif InsideTheWall(evadeTo2) then
  2040. safeTarget = evadeTo1
  2041. elseif InsideTheWall(evadeTo1) then
  2042. safeTarget = evadeTo2
  2043. end
  2044. if safeTarget ~= nil then
  2045. evadeTo(safeTarget.x, safeTarget.y, true)
  2046. skillshot.alreadydashed = true
  2047. return true
  2048. else return false
  2049. end
  2050. else return false
  2051. end
  2052. else return false
  2053. end
  2054. return false
  2055. end
  2056.  
  2057. function lineSkillshot4(skillshot, evadeTo1, evadeTo2)
  2058. if GoodEvadeConfig.lineallways then
  2059. if skillshotLine:distance(evadeTo1) >= skillshotLine:distance(evadeTo2) then
  2060. if not InsideTheWall(evadeTo1) then
  2061. safeTarget = evadeTo1
  2062. elseif not InsideTheWall(evadeTo2) then
  2063. safeTarget = evadeTo2
  2064. else
  2065. safeTarget = getLastMovementDestination()
  2066. end
  2067.  
  2068. else
  2069. if not InsideTheWall(evadeTo2) then
  2070. safeTarget = evadeTo2
  2071. elseif not InsideTheWall(evadeTo1) then
  2072. safeTarget = evadeTo1
  2073. else
  2074. safeTarget = getLastMovementDestination()
  2075. end
  2076. end
  2077.  
  2078. if safeTarget ~= nil then
  2079. evadeTo(safeTarget.x, safeTarget.y)
  2080. return true
  2081. else return false
  2082. end
  2083. else return false
  2084. end
  2085. return false
  2086. end
  2087.  
  2088. function dodgeCrescendo1(skillshot)
  2089. if haveShield() then
  2090. for i, detectedSkillshot in ipairs(detectedSkillshots) do
  2091. if detectedSkillshot.skillshot.name == skillshot.skillshot.name then
  2092. table.remove(detectedSkillshots, i)
  2093. i = i-1
  2094. if detectedSkillshot.evading then
  2095. continueMovement(detectedSkillshot)
  2096. end
  2097. end
  2098. end
  2099. if isSivir then
  2100. CastSpell(_E)
  2101. elseif isNocturne then
  2102. CastSpell(_W)
  2103. end
  2104. return true
  2105. else return false
  2106. end
  2107. return false
  2108. end
  2109.  
  2110. function dodgeCrescendo2(skillshot, evadeTo1, evadeTo2)
  2111. local safeTarget = nil
  2112. if haveflash and useflash and not skillshot.alreadydashed
  2113. then if (evadeTo1:distance(lastMovement.destination) > evadeTo2:distance(lastMovement.destination)) and not InsideTheWall(evadeTo2) then
  2114. safeTarget = evadeTo2
  2115. elseif (evadeTo2:distance(lastMovement.destination) > evadeTo1:distance(lastMovement.destination)) and not InsideTheWall(evadeTo1) then
  2116. safeTarget = evadeTo1
  2117. elseif InsideTheWall(evadeTo2) then
  2118. safeTarget = evadeTo1
  2119. elseif InsideTheWall(evadeTo1) then
  2120. safeTarget = evadeTo2
  2121. end
  2122. if safeTarget ~= nil then
  2123. FlashTo(safeTarget.x, safeTarget.y)
  2124. skillshot.alreadydashed = true
  2125. return true
  2126. else return false
  2127. end
  2128. else return false
  2129. end
  2130. return false
  2131. end
  2132. -- end of line skillshot dodging functions --
Advertisement
Add Comment
Please, Sign In to add comment