private static void evadeGrabADCMode(Skillshot skillShot, Obj_AI_Hero mate) { if (((skillShot.SpellData.MissileSpellName == "RocketGrabMissile") & (generalMenu.Item("blitzok").GetValue<bool>())) | ((skillShot.SpellData.MissileSpellName == "ThreshQMissile") & (generalMenu.Item("threshok").GetValue<bool>())) | ((skillShot.SpellData.MissileSpellName == "DarkBindingMissile") & (generalMenu.Item("morganaok").GetValue<bool>())) | ((skillShot.SpellData.MissileSpellName == "SadMummyBandageToss") & (generalMenu.Item("amumuok").GetValue<bool>()))) { if (!skillShot.IsSafe(mate.ServerPosition.To2D())) { if (champion.ChampionName == "Zyra") { W.Cast(mate.Position.Extend(skillShot.Unit.Position, +75), skillShot.Unit.Position); E.Cast(mate.Position.Extend(skillShot.Unit.Position, +75), skillShot.Unit.Position); } else if (champion.ChampionName == "Heimerdinger") { Q.Cast(mate.Position.Extend(skillShot.Unit.Position, +75), skillShot.Unit.Position); } else if (champion.ChampionName == "Shaco") { W.Cast(mate.Position.Extend(skillShot.Unit.Position, +50), skillShot.Unit.Position); } else if (champion.ChampionName == "Yorick") { W.Cast(mate.Position.Extend(skillShot.Unit.Position, +75), skillShot.Unit.Position); } else if (champion.ChampionName == "Yasuo") { W.Cast(mate.Position.Extend(skillShot.Unit.Position, +75), skillShot.Unit.Position); } else if (champion.ChampionName == "Morgana") { E.CastOnUnit(mate); } else if (champion.ChampionName == "Annie") { R.Cast(mate.Position.Extend(skillShot.Unit.Position, +50), skillShot.Unit.Position); } else if (champion.ChampionName == "Thresh") { var prediction = Q.GetPrediction(skillShot.Unit); Q.Cast(prediction.CastPosition); } else if (champion.ChampionName == "Blitzcrank") { var prediction = Q.GetPrediction(skillShot.Unit); Q.Cast(prediction.CastPosition); } } DetectedSkillshots.Clear(); } }
public static Vector2 GetCollisionPoint(Skillshot skillshot) { var collisions = new List<DetectedCollision>(); var from = skillshot.GetMissilePosition(0); skillshot.ForceDisabled = false; foreach (var cObject in skillshot.SpellData.CollisionObjects) { switch (cObject) { case CollisionObjectTypes.Minion: foreach (var minion in MinionManager.GetMinions( from.To3D(), 1200, MinionTypes.All, skillshot.Unit.Team == ObjectManager.Player.Team ? MinionTeam.NotAlly : MinionTeam.NotAllyForEnemy)) { var pred = FastPrediction( from, minion, Math.Max(0, skillshot.SpellData.Delay - (Utils.TickCount - skillshot.StartTick)), skillshot.SpellData.MissileSpeed); var pos = pred.PredictedPos; var w = skillshot.SpellData.RawRadius + (!pred.IsMoving ? (minion.BoundingRadius - 15) : 0) - pos.Distance(from, skillshot.End, true); if (w > 0) { collisions.Add( new DetectedCollision { Position = pos.ProjectOn(skillshot.End, skillshot.Start).LinePoint + skillshot.Direction * 30, Unit = minion, Type = CollisionObjectTypes.Minion, Distance = pos.Distance(from), Diff = w, }); } } break; case CollisionObjectTypes.Champions: foreach (var hero in ObjectManager.Get<Obj_AI_Hero>() .Where( h => (h.IsValidTarget(1200, false) && h.Team == ObjectManager.Player.Team && !h.IsMe || Config.TestOnAllies && h.Team != ObjectManager.Player.Team))) { var pred = FastPrediction( from, hero, Math.Max(0, skillshot.SpellData.Delay - (Utils.TickCount - skillshot.StartTick)), skillshot.SpellData.MissileSpeed); var pos = pred.PredictedPos; var w = skillshot.SpellData.RawRadius + 30 - pos.Distance(from, skillshot.End, true); if (w > 0) { collisions.Add( new DetectedCollision { Position = pos.ProjectOn(skillshot.End, skillshot.Start).LinePoint + skillshot.Direction * 30, Unit = hero, Type = CollisionObjectTypes.Minion, Distance = pos.Distance(from), Diff = w, }); } } break; case CollisionObjectTypes.YasuoWall: if ( !ObjectManager.Get<Obj_AI_Hero>() .Any( hero => hero.IsValidTarget(float.MaxValue, false) && hero.Team == ObjectManager.Player.Team && hero.ChampionName == "Yasuo")) { break; } GameObject wall = null; foreach (var gameObject in ObjectManager.Get<GameObject>()) { if (gameObject.IsValid && System.Text.RegularExpressions.Regex.IsMatch( gameObject.Name, "_w_windwall.\\.troy", System.Text.RegularExpressions.RegexOptions.IgnoreCase)) { wall = gameObject; } } if (wall == null) { break; } var level = wall.Name.Substring(wall.Name.Length - 6, 1); var wallWidth = (300 + 50 * Convert.ToInt32(level)); var wallDirection = (wall.Position.To2D() - YasuoWallCastedPos).Normalized().Perpendicular(); var wallStart = wall.Position.To2D() + wallWidth / 2 * wallDirection; var wallEnd = wallStart - wallWidth * wallDirection; var wallPolygon = new Geometry.Rectangle(wallStart, wallEnd, 75).ToPolygon(); var intersection = new Vector2(); var intersections = new List<Vector2>(); for (var i = 0; i < wallPolygon.Points.Count; i++) { var inter = wallPolygon.Points[i].Intersection( wallPolygon.Points[i != wallPolygon.Points.Count - 1 ? i + 1 : 0], from, skillshot.End); if (inter.Intersects) { intersections.Add(inter.Point); } } if (intersections.Count > 0) { intersection = intersections.OrderBy(item => item.Distance(from)).ToList()[0]; var collisionT = Utils.TickCount + Math.Max( 0, skillshot.SpellData.Delay - (Utils.TickCount - skillshot.StartTick)) + 100 + (1000 * intersection.Distance(from)) / skillshot.SpellData.MissileSpeed; if (collisionT - WallCastT < 4000) { if (skillshot.SpellData.Type != SkillShotType.SkillshotMissileLine) { skillshot.ForceDisabled = true; } return intersection; } } break; } } Vector2 result; if (collisions.Count > 0) { result = collisions.OrderBy(c => c.Distance).ToList()[0].Position; } else { result = new Vector2(); } return result; }
private static void TriggerOnDetectSkillshot(DetectionType detectionType, SpellData spellData, int startT, Vector2 start, Vector2 end, Obj_AI_Base unit) { var skillshot = new Skillshot(detectionType, spellData, startT, start, end, unit); if (OnDetectSkillshot != null) { OnDetectSkillshot(skillshot); } }
//Credits to detuks and his Yasuo script for some part of this private static void OnDetectSkillshot(Skillshot skillshot) { var alreadyAdded = false; foreach (var item in DetectedSkillshots) { if (item.SpellData.SpellName == skillshot.SpellData.SpellName && (item.Unit.NetworkId == skillshot.Unit.NetworkId && (skillshot.Direction).AngleBetween(item.Direction) < 5 && (skillshot.Start.Distance(item.Start) < 100 || skillshot.SpellData.FromObjects.Length == 0))) { alreadyAdded = true; } } //Check if the skillshot is from an ally. if (skillshot.Unit.Team == champion.Team) { return; } //Check if the skillshot is too far away. if (skillshot.Start.Distance(champion.ServerPosition.To2D()) > (skillshot.SpellData.Range + skillshot.SpellData.Radius + 1000) * 1.5) { return; } //Add the skillshot to the detected skillshot list. if (!alreadyAdded) { DetectedSkillshots.Add(skillshot); } }
public static Vector2 GetCollisionPoint(Skillshot skillshot) { var collisions = new List <DetectedCollision>(); var from = skillshot.GetMissilePosition(0); skillshot.ForceDisabled = false; foreach (var cObject in skillshot.SpellData.CollisionObjects) { switch (cObject) { case CollisionObjectTypes.Minion: foreach (var minion in MinionManager.GetMinions( from.To3D(), 1200, MinionTypes.All, skillshot.Unit.Team == ObjectManager.Player.Team ? MinionTeam.NotAlly : MinionTeam.NotAllyForEnemy)) { var pred = FastPrediction( from, minion, Math.Max(0, skillshot.SpellData.Delay - (Utils.TickCount - skillshot.StartTick)), skillshot.SpellData.MissileSpeed); var pos = pred.PredictedPos; var w = skillshot.SpellData.RawRadius + (!pred.IsMoving ? (minion.BoundingRadius - 15) : 0) - pos.Distance(from, skillshot.End, true); if (w > 0) { collisions.Add( new DetectedCollision { Position = pos.ProjectOn(skillshot.End, skillshot.Start).LinePoint + skillshot.Direction * 30, Unit = minion, Type = CollisionObjectTypes.Minion, Distance = pos.Distance(from), Diff = w, }); } } break; case CollisionObjectTypes.Champions: foreach (var hero in ObjectManager.Get <AIHeroClient>() .Where( h => (h.IsValidTarget(1200, false) && h.Team == ObjectManager.Player.Team && !h.IsMe || Config.TestOnAllies && h.Team != ObjectManager.Player.Team))) { var pred = FastPrediction( from, hero, Math.Max(0, skillshot.SpellData.Delay - (Utils.TickCount - skillshot.StartTick)), skillshot.SpellData.MissileSpeed); var pos = pred.PredictedPos; var w = skillshot.SpellData.RawRadius + 30 - pos.Distance(from, skillshot.End, true); if (w > 0) { collisions.Add( new DetectedCollision { Position = pos.ProjectOn(skillshot.End, skillshot.Start).LinePoint + skillshot.Direction * 30, Unit = hero, Type = CollisionObjectTypes.Minion, Distance = pos.Distance(from), Diff = w, }); } } break; case CollisionObjectTypes.YasuoWall: if ( !ObjectManager.Get <AIHeroClient>() .Any( hero => hero.IsValidTarget(float.MaxValue, false) && hero.Team == ObjectManager.Player.Team && hero.ChampionName == "Yasuo")) { break; } GameObject wall = null; foreach (var gameObject in ObjectManager.Get <GameObject>()) { if (gameObject.IsValid && System.Text.RegularExpressions.Regex.IsMatch( gameObject.Name, "_w_windwall.\\.troy", System.Text.RegularExpressions.RegexOptions.IgnoreCase)) { wall = gameObject; } } if (wall == null) { break; } var level = wall.Name.Substring(wall.Name.Length - 6, 1); var wallWidth = (300 + 50 * Convert.ToInt32(level)); var wallDirection = (wall.Position.To2D() - YasuoWallCastedPos).Normalized().Perpendicular(); var wallStart = wall.Position.To2D() + wallWidth / 2 * wallDirection; var wallEnd = wallStart - wallWidth * wallDirection; var wallPolygon = new Geometry.Rectangle(wallStart, wallEnd, 75).ToPolygon(); var intersection = new Vector2(); var intersections = new List <Vector2>(); for (var i = 0; i < wallPolygon.Points.Count; i++) { var inter = wallPolygon.Points[i].Intersection( wallPolygon.Points[i != wallPolygon.Points.Count - 1 ? i + 1 : 0], from, skillshot.End); if (inter.Intersects) { intersections.Add(inter.Point); } } if (intersections.Count > 0) { intersection = intersections.OrderBy(item => item.Distance(from)).ToList()[0]; var collisionT = Utils.TickCount + Math.Max( 0, skillshot.SpellData.Delay - (Utils.TickCount - skillshot.StartTick)) + 100 + (1000 * intersection.Distance(from)) / skillshot.SpellData.MissileSpeed; if (collisionT - WallCastT < 4000) { if (skillshot.SpellData.Type != SkillShotType.SkillshotMissileLine) { skillshot.ForceDisabled = true; } return(intersection); } } break; } } Vector2 result; if (collisions.Count > 0) { result = collisions.OrderBy(c => c.Distance).ToList()[0].Position; } else { result = new Vector2(); } return(result); }