float GetShortesTimeAvailiableInInsidePath(Vector2[] path, EvadeSkillshot spell) { List <Vector2> detailedPath = new List <Vector2>(); var first = path.FirstOrDefault(); var last = path.LastOrDefault(); float shortestTime = spell.GetAvailableTime(Player.Instance.Position.To2D()); shortestTime = Math.Max(0, shortestTime - (Game.Ping + ServerTimeBuffer)); if (first == default(Vector2) || last == default(Vector2) || first == last) { return(shortestTime); } detailedPath.Add(first); detailedPath.Add(last); foreach (Vector2 pathPoint in detailedPath.Where(x => spell.ToPolygon().IsInside(x))) { float maxTime = spell.GetAvailableTime(pathPoint); float time = Math.Max(0, maxTime - (Game.Ping + ServerTimeBuffer)); shortestTime = Math.Min(shortestTime, time); } return(shortestTime); }
public static bool IsSkillshotDrawingEnabled(EvadeSkillshot skillshot) { var valueBase = SkillshotMenu[skillshot + "/draw"]; return((valueBase != null && valueBase.Cast <CheckBox>().CurrentValue) || DebugMenu["debugMode"].Cast <KeyBind>().CurrentValue); }
private void OnSkillshotDetected(EvadeSkillshot skillshot, bool isProcessSpell) { //TODO: update if (skillshot.ToPolygon().IsInside(Player.Instance)) { LastEvadeResult = null; } }
private void OnSkillshotDeleted(EvadeSkillshot skillshot) { if (RestorePosition && !SkillshotDetector.DetectedSkillshots.Any()) { if (CurrentEvadeResult != null && Player.Instance.IsMovingTowards(CurrentEvadeResult.EvadePoint)) { Player.IssueOrder(GameObjectOrder.MoveTo, LastIssueOrderPos.To3DWorld(), false); } } }
private void OnSkillshotDetected(EvadeSkillshot skillshot, bool isProcessSpell) { if (CurrentEvadeResult != null && CurrentEvadeResult.EnoughTime) { if (!skillshot.IsSafePath(Player.Instance.GetPath(CurrentEvadeResult.WalkPoint).ToVector2(), ServerTimeBuffer + Game.Ping)) { CurrentEvadeResult = null; } } }
private void OnSkillshotDeleted(EvadeSkillshot skillshot) { if (RestorePosition && !SpellDetector.DetectedSkillshots.Any()) { if (AutoPathing.IsPathing && Player.Instance.IsWalking()) { var destination = AutoPathing.Destination; AutoPathing.StopPath(); Player.IssueOrder(GameObjectOrder.MoveTo, destination.To3DWorld(), false); } else if (LastEvadeResult != null && Player.Instance.IsMovingTowards(LastEvadeResult.EvadePoint)) { Player.IssueOrder(GameObjectOrder.MoveTo, LastIssueOrderPos.To3DWorld(), false); } } }
private static void OnUpdateTarget(EventArgs args) { if (Variables._Player.IsDead) { return; } if (Variables._Player.HasBuffOfType(BuffType.SpellImmunity) || Variables._Player.HasBuffOfType(BuffType.SpellShield)) { return; } if (!Program.W.IsReady(300) && (Wall == null || !Program.E.IsReady(200))) { return; } foreach (var target in DetectedTargets.Where(i => Variables._Player.Distance(i.Obj.Position) < 700)) { if (Program.E.IsReady() && evadeMenu2["E"].Cast <CheckBox>().CurrentValue&& Wall != null && !GoThroughWall(Variables._Player.ServerPosition.To2D(), target.Obj.Position.To2D()) && Program.W.IsInRange(target.Obj.Position)) { var obj = new List <Obj_AI_Base>(); obj.AddRange(EntityManager.MinionsAndMonsters.GetLaneMinions(EntityManager.UnitTeam.Enemy, Variables._Player.ServerPosition, Program.E.Range)); obj.AddRange(EntityManager.Heroes.Enemies.Where(i => i.IsValidTarget(Program.E.Range))); if ( obj.Where( i => Variables.CanCastE(i) && EvadeSkillshot.IsSafePoint(i.ServerPosition.To2D()).IsSafe && EvadeSkillshot.IsSafePoint(Variables.PosAfterE(i).To2D()).IsSafe && (!Variables.PosAfterE(i).IsUnderTurret() || evadeMenu2["ETower"].Cast <CheckBox>().CurrentValue) && GoThroughWall(Variables._Player.ServerPosition.To2D(), Variables.PosAfterE(i).To2D())) .OrderBy(i => Variables.PosAfterE(i).Distance(Game.CursorPos)) .Any(i => Program.E.Cast(i))) { return; } } if (Program.W.IsReady() && evadeMenu2["W"].Cast <CheckBox>().CurrentValue&& Program.W.IsInRange(target.Obj.Position)) { Program.W.Cast((Vector3)Variables._Player.ServerPosition.Extend(target.Start, 100)); } } }
public MoonWalkEvade(SpellDetector detector) { Skillshots = new EvadeSkillshot[] { }; Polygons = new Geometry.Polygon[] { }; ClippedPolygons = new List <Geometry.Polygon>(); StatusText = new Text("MoonWalkEvade", new Font("Euphemia", 10F, FontStyle.Bold)); //Calisto MT _skillshotPolygonCache = new Dictionary <EvadeSkillshot, Geometry.Polygon>(); SpellDetector = detector; SpellDetector.OnUpdateSkillshots += OnUpdateSkillshots; SpellDetector.OnSkillshotActivation += OnSkillshotActivation; SpellDetector.OnSkillshotDetected += OnSkillshotDetected; SpellDetector.OnSkillshotDeleted += OnSkillshotDeleted; Player.OnIssueOrder += PlayerOnIssueOrder; Obj_AI_Base.OnProcessSpellCast += OnProcessSpellCast; Dash.OnDash += OnDash; Game.OnTick += Ontick; Drawing.OnDraw += OnDraw; }
public MoonWalkEvade(SpellDetector detector) { Skillshots = new EvadeSkillshot[] { }; Polygons = new Geometry.Polygon[] { }; ClippedPolygons = new List <Geometry.Polygon>(); StatusText = new Text("MoonWalkEvade Enabled", new Font("Euphemia", 10F, FontStyle.Bold)); //Calisto MT WarnText = new Text("", new Font("Euphemia", 18F, FontStyle.Bold)); //Calisto MT _skillshotPolygonCache = new Dictionary <EvadeSkillshot, Geometry.Polygon>(); SkillshotDetector = detector; SkillshotDetector.OnUpdateSkillshots += OnUpdateSkillshots; SkillshotDetector.OnSkillshotActivation += OnSkillshotActivation; SkillshotDetector.OnSkillshotDetected += OnSkillshotDetected; SkillshotDetector.OnSkillshotDeleted += OnSkillshotDeleted; Player.OnIssueOrder += PlayerOnIssueOrder; Spellbook.OnCastSpell += SpellbookOnOnCastSpell; Dash.OnDash += OnDash; Game.OnUpdate += OnUpdate; Drawing.OnDraw += OnDraw; }
private void OnSkillshotActivation(EvadeSkillshot skillshot) { CacheSkillshots(); }
private void OnUpdateSkillshots(EvadeSkillshot skillshot, bool remove, bool isProcessSpell) { CacheSkillshots(); }
public bool IsPathSafeEx(Vector2[] path, AIHeroClient hero = null) { hero = hero ?? Player.Instance; path = new[] { hero.Position.To2D(), LastIssueOrderPos }; var pathStart = path[0]; var pathEnd = path[1]; foreach (var pair in _skillshotPolygonCache) { EvadeSkillshot skillshot = pair.Key; var polygon = pair.Value; Func <Vector2, bool> isInside = point => { if (skillshot.OwnSpellData.IsVeigarE) { return(skillshot.ToInnerPolygon().IsOutside(point) && skillshot.ToOuterPolygon().IsInside(point)); } return(polygon.IsInside(point)); }; var intersections = polygon.GetIntersectionPointsWithLineSegment(hero.Position.To2D(), pathEnd); if (intersections.Length == 0 && isInside(hero.Position.To2D()) && isInside(pathEnd)) { var time2 = skillshot.GetAvailableTime(pathEnd); if (hero.WalkingTime(hero.Position.To2D(), pathEnd) >= time2 - Game.Ping) { //Chat.Print(Game.Time + " path unsafe"); return(false); } } else if (intersections.Length == 0 && !isInside(pathStart) && !isInside(pathEnd)) { continue; //safe path for now => next skillshot } if (intersections.Length == 1) { bool beingInside = isInside(pathStart); if (beingInside) { float skillshotTime = skillshot.GetAvailableTime(intersections[0]); skillshotTime = Math.Max(0, skillshotTime - (Game.Ping + ServerTimeBuffer)); bool enoughTime = hero.WalkingTime(hero.Position.To2D(), intersections[0]) < skillshotTime; if (!enoughTime) { //Chat.Print(Game.Time + " path unsafe"); return(false); } } else //being outside { float walkTimeToEdge = hero.WalkingTime(hero.Position.To2D(), intersections[0]); float skillshotTime = skillshot.GetAvailableTime(intersections[0]); skillshotTime = Math.Max(0, skillshotTime - (Game.Ping + ServerTimeBuffer)); float time = skillshotTime - walkTimeToEdge; if (time > -100) { //Chat.Print(Game.Time + " path unsafe"); return(false); } } } else if (intersections.Length >= 2) //cross { if (skillshot.OwnSpellData.ForbidCrossing) { return(false); } var firstDangerPoint = intersections.OrderBy(x => x.Distance(hero)).First(); var crossPoint = intersections.OrderBy(x => x.Distance(hero)).Last(); var walkTimeToDangerStart = hero.WalkingTime(hero.Position.To2D(), firstDangerPoint); var walkTimeToDangerEnd = hero.WalkingTime(hero.Position.To2D(), crossPoint); float maxTime1 = skillshot.GetAvailableTime(firstDangerPoint); float time1 = Math.Max(0, maxTime1 - Game.Ping + ServerTimeBuffer); float maxTime2 = skillshot.GetAvailableTime(crossPoint); float time2 = Math.Max(0, maxTime2 - Game.Ping + ServerTimeBuffer); bool dangerStartUnsafe = time1 - walkTimeToDangerStart > 0; bool dangerEndUnsafe = walkTimeToDangerEnd > time2; if (dangerStartUnsafe && dangerEndUnsafe) { //Chat.Print(Game.Time + " path unsafe"); return(false); } } } return(true); }
public static bool IsSkillshotEnabled(EvadeSkillshot skillshot) { var valueBase = SkillshotMenu[skillshot + "/enable"]; return(valueBase != null && valueBase.Cast <CheckBox>().CurrentValue); }