internal static Vector2 GetCollisionPoint(this 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: collisions.AddRange( from minion in GameObjects.Minions.Where( i => i.IsValidTarget(1200, false, @from.ToVector3()) && (skillshot.Unit.Team == ObjectManager.Player.Team ? i.Team != ObjectManager.Player.Team : i.Team == ObjectManager.Player.Team || i.Team == GameObjectTeam.Neutral)) let pred = @from.FastPrediction( minion, Math.Max(0, skillshot.SpellData.Delay - (Variables.TickCount - skillshot.StartTick)), skillshot.SpellData.MissileSpeed) let pos = pred.PredictedPos let w = skillshot.SpellData.RawRadius + (!pred.IsMoving ? minion.BoundingRadius - 15 : 0) - pos.Distance(@from, skillshot.End, true) where w > 0 select new DetectedCollision { Position = pos.ProjectOn(skillshot.End, skillshot.Start).LinePoint + skillshot.Direction * 30, Unit = minion, Type = cObject, Distance = pos.Distance(@from), Diff = w }); break; case CollisionObjectTypes.Champion: collisions.AddRange( from hero in GameObjects.AllyHeroes.Where(i => i.IsValidTarget(1200, false) && !i.IsMe) let pred = @from.FastPrediction( hero, Math.Max(0, skillshot.SpellData.Delay - (Variables.TickCount - skillshot.StartTick)), skillshot.SpellData.MissileSpeed) let pos = pred.PredictedPos let w = skillshot.SpellData.RawRadius + 30 - pos.Distance(@from, skillshot.End, true) where w > 0 select new DetectedCollision { Position = pos.ProjectOn(skillshot.End, skillshot.Start).LinePoint + skillshot.Direction * 30, Unit = hero, Type = cObject, Distance = pos.Distance(@from), Diff = w }); break; case CollisionObjectTypes.YasuoWall: if ( !GameObjects.AllyHeroes.Any( i => i.IsValidTarget(float.MaxValue, false) && i.ChampionName == "Yasuo")) { break; } var wall = GameObjects.AllGameObjects.FirstOrDefault( i => i.IsValid && Regex.IsMatch(i.Name, "_w_windwall.\\.troy", RegexOptions.IgnoreCase)); if (wall == null) { break; } var wallWidth = 300 + 50 * Convert.ToInt32(wall.Name.Substring(wall.Name.Length - 6, 1)); var wallDirection = (wall.Position.ToVector2() - yasuoWallCastedPos).Normalized().Perpendicular(); var wallStart = wall.Position.ToVector2() + wallWidth / 2f * wallDirection; var wallEnd = wallStart - wallWidth * wallDirection; var wallPolygon = new Rectangle(wallStart, wallEnd, 75); 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) { var intersection = intersections.MinOrDefault(i => i.Distance(@from)); if (Variables.TickCount + Math.Max(0, skillshot.SpellData.Delay - (Variables.TickCount - skillshot.StartTick)) + 100 + (1000 * intersection.Distance(@from)) / skillshot.SpellData.MissileSpeed - yasuoWallCastT < 4000) { if (skillshot.SpellData.Type != SkillShotType.SkillshotMissileLine) { skillshot.ForceDisabled = true; } return intersection; } } break; } } return collisions.Count > 0 ? collisions.MinOrDefault(i => i.Distance).Position : new Vector2(); }
private static void Combo() { if (MainMenu["Orbwalk"]["R"] && R.IsReady()) { foreach (var hero in GameObjects.EnemyHeroes.Where( i => i.IsValidTarget(R.Range) && i.Health + i.PhysicalShield > Player.GetSpellDamage(i, SpellSlot.R)) .OrderBy(i => i.Distance(Player))) { var rect = new Rectangle( hero.ServerPosition, hero.ServerPosition.Extend(Player.ServerPosition, -RKickRange), hero.BoundingRadius * 2); var heroBehind = (from behind in GameObjects.EnemyHeroes.Where( i => i.IsValidTarget(RKickRange, true, hero.ServerPosition) && i.NetworkId != hero.NetworkId) let predPos = Prediction.GetPrediction(behind, R.Delay, 1, R.Speed).UnitPosition where rect.IsInside(predPos) select behind).ToList(); if (heroBehind.Count == 0) { break; } if (MainMenu["Orbwalk"]["RKill"] && heroBehind.Any(i => i.Health + i.PhysicalShield <= Player.GetSpellDamage(i, SpellSlot.R)) && R.CastOnUnit(hero)) { return; } if (heroBehind.Count >= MainMenu["Orbwalk"]["RCountA"] && R.CastOnUnit(hero)) { return; } } } if (MainMenu["Orbwalk"]["Q"] && Q.IsReady() && CanCastInOrbwalk) { if (IsQOne) { var target = Q.GetTarget(); if (target != null) { var pred = Q.VPrediction(target); if (pred.Hitchance == HitChance.Collision) { if (MainMenu["Orbwalk"]["QCol"] && Smite.IsReady() && pred.CollisionObjects.All(i => i.NetworkId != Player.NetworkId)) { var col = pred.CollisionObjects.Cast<Obj_AI_Minion>().ToList(); if (col.Count == 1 && col.Any(i => i.Health <= GetSmiteDmg && Player.Distance(i) < SmiteRange) && Player.Spellbook.CastSpell(Smite, col.First())) { Q.Cast(pred.CastPosition); return; } } } else if (pred.Hitchance >= Q.MinHitChance && Q.Cast(pred.CastPosition)) { return; } } } else if (MainMenu["Orbwalk"]["Q2"]) { var target = GameObjects.EnemyHeroes.FirstOrDefault(i => i.IsValidTarget(Q2.Range) && HaveQ(i)); if (target != null) { if ((CanQ2(target) || (!target.InAutoAttackRange() && CanR) || target.Health + target.PhysicalShield <= Player.GetSpellDamage(target, SpellSlot.Q, Damage.DamageStage.SecondCast) + Player.GetAutoAttackDamage(target, true) || Player.Distance(target) > target.GetRealAutoAttackRange() + 100 || Passive == -1) && Q.Cast()) { return; } } else if (GetQObj != null) { var q2Target = Q2.GetTarget(); if (q2Target != null && GetQObj.Distance(q2Target) < Player.Distance(q2Target) && !q2Target.InAutoAttackRange() && Q.Cast()) { return; } } } } if (MainMenu["Orbwalk"]["E"] && E.IsReady() && CanCastInOrbwalk) { if (IsEOne) { if (E.GetTarget() != null && Player.Mana >= 70 && E.Cast()) { return; } } else { var e2Target = GameObjects.EnemyHeroes.Where(i => i.IsValidTarget(E2.Range) && HaveE(i)).ToList(); if ((e2Target.Any(i => CanE2(i) || Player.Distance(i) > i.GetRealAutoAttackRange() + 50) || e2Target.Count > 2 || Passive == -1) && E.Cast()) { return; } } } if (MainMenu["Orbwalk"]["W"] && W.IsReady() && CanCastInOrbwalk && Variables.TickCount - W.LastCastAttemptT >= 300 && !E.IsReady() && Passive == -1 && Orbwalker.GetTarget(OrbwalkingMode.Combo) != null && W.Cast()) { return; } var subTarget = W.GetTarget(); if (MainMenu["Orbwalk"]["Item"]) { UseItem(subTarget); } if (subTarget == null) { return; } if (MainMenu["Orbwalk"]["Ignite"] && Ignite.IsReady() && subTarget.HealthPercent < 30 && Player.Distance(subTarget) <= IgniteRange) { Player.Spellbook.CastSpell(Ignite, subTarget); } }
internal static Vector2 GetCollisionPoint(this 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: collisions.AddRange( from minion in GameObjects.Minions.Where( i => i.IsValidTarget(1200, false, @from.ToVector3()) && skillshot.Unit.IsAlly ? i.IsEnemy : i.IsAlly) let pred = FastPrediction( @from, minion, Math.Max(0, skillshot.SpellData.Delay - (Variables.TickCount - skillshot.StartTick)), skillshot.SpellData.MissileSpeed) let pos = pred.PredictedPos let w = skillshot.SpellData.RawRadius + (!pred.IsMoving ? minion.BoundingRadius - 15 : 0) - pos.Distance(@from, skillshot.End, true) where w > 0 select new DetectedCollision { Position = pos.ProjectOn(skillshot.End, skillshot.Start).LinePoint + skillshot.Direction * 30, Unit = minion, Type = cObject, Distance = pos.Distance(@from), Diff = w }); break; case CollisionObjectTypes.Champion: collisions.AddRange( from hero in GameObjects.AllyHeroes.Where(i => i.IsValidTarget(1200, false) && !i.IsMe) let pred = FastPrediction( @from, hero, Math.Max(0, skillshot.SpellData.Delay - (Variables.TickCount - skillshot.StartTick)), skillshot.SpellData.MissileSpeed) let pos = pred.PredictedPos let w = skillshot.SpellData.RawRadius + 30 - pos.Distance(@from, skillshot.End, true) where w > 0 select new DetectedCollision { Position = pos.ProjectOn(skillshot.End, skillshot.Start).LinePoint + skillshot.Direction * 30, Unit = hero, Type = cObject, Distance = pos.Distance(@from), Diff = w }); break; case CollisionObjectTypes.YasuoWall: if ( !GameObjects.AllyHeroes.Any( i => i.IsValidTarget(float.MaxValue, false) && i.ChampionName == "Yasuo")) { break; } var wall = GameObjects.AllGameObjects.FirstOrDefault( i => i.IsValid && Regex.IsMatch(i.Name, "_w_windwall.\\.troy", RegexOptions.IgnoreCase)); if (wall == null) { break; } var wallWidth = 300 + 50 * Convert.ToInt32(wall.Name.Substring(wall.Name.Length - 6, 1)); var wallDirection = (wall.Position - yasuoWallCastedPos).Normalized().Perpendicular(); var wallStart = wall.Position + wallWidth / 2f * wallDirection; var wallEnd = wallStart - wallWidth * wallDirection; var wallPolygon = new Rectangle(wallStart, wallEnd, 75); 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) { var intersection = intersections.OrderBy(i => i.Distance(@from)).ToList()[0]; if (Variables.TickCount + Math.Max(0, skillshot.SpellData.Delay - (Variables.TickCount - skillshot.StartTick)) + 100 + (1000 * intersection.Distance(@from)) / skillshot.SpellData.MissileSpeed - yasuoWallCastT < 4000) { if (skillshot.SpellData.Type != SkillShotType.SkillshotMissileLine) { skillshot.ForceDisabled = true; } return(intersection); } } break; } } return(collisions.Count > 0 ? collisions.OrderBy(i => i.Distance).ToList()[0].Position : new Vector2()); }
private static void Combo() { if (MainMenu["Orbwalk"]["R"] && R.IsReady()) { foreach (var hero in GameObjects.EnemyHeroes.Where( i => i.IsValidTarget(R.Range) && i.Health + i.PhysicalShield > Player.GetSpellDamage(i, SpellSlot.R)) .OrderBy(i => i.Distance(Player))) { var rect = new Rectangle( hero.ServerPosition, hero.ServerPosition.Extend(Player.ServerPosition, -RKickRange), hero.BoundingRadius * 2); var heroBehind = (from behind in GameObjects.EnemyHeroes.Where( i => i.IsValidTarget(RKickRange, true, hero.ServerPosition) && i.NetworkId != hero.NetworkId) let predPos = Prediction.GetPrediction(behind, R.Delay, 1, R.Speed).UnitPosition where rect.IsInside(predPos) select behind).ToList(); if (heroBehind.Count == 0) { break; } if (MainMenu["Orbwalk"]["RKill"] && heroBehind.Any(i => i.Health + i.PhysicalShield <= Player.GetSpellDamage(i, SpellSlot.R)) && R.CastOnUnit(hero)) { return; } if (heroBehind.Count >= MainMenu["Orbwalk"]["RCountA"] && R.CastOnUnit(hero)) { return; } } } if (MainMenu["Orbwalk"]["Q"] && Q.IsReady() && CanCastInOrbwalk) { if (IsQOne) { var target = Q.GetTarget(); if (target != null) { var pred = Q.VPrediction(target); if (pred.Hitchance == HitChance.Collision) { if (MainMenu["Orbwalk"]["QCol"] && Smite.IsReady() && pred.CollisionObjects.All(i => i.NetworkId != Player.NetworkId)) { var col = pred.CollisionObjects.Cast <Obj_AI_Minion>().ToList(); if (col.Count == 1 && col.Any(i => i.Health <= GetSmiteDmg && Player.Distance(i) < SmiteRange) && Player.Spellbook.CastSpell(Smite, col.First())) { Q.Cast(pred.CastPosition); return; } } } else if (pred.Hitchance >= Q.MinHitChance && Q.Cast(pred.CastPosition)) { return; } } } else if (MainMenu["Orbwalk"]["Q2"]) { var target = GameObjects.EnemyHeroes.FirstOrDefault(i => i.IsValidTarget(Q2.Range) && HaveQ(i)); if (target != null) { if ((CanQ2(target) || (!target.InAutoAttackRange() && CanR) || target.Health + target.PhysicalShield <= Player.GetSpellDamage(target, SpellSlot.Q, Damage.DamageStage.SecondCast) + Player.GetAutoAttackDamage(target, true) || Player.Distance(target) > target.GetRealAutoAttackRange() + 100 || Passive == -1) && Q.Cast()) { return; } } else if (GetQObj != null) { var q2Target = Q2.GetTarget(); if (q2Target != null && GetQObj.Distance(q2Target) < Player.Distance(q2Target) && !q2Target.InAutoAttackRange() && Q.Cast()) { return; } } } } if (MainMenu["Orbwalk"]["E"] && E.IsReady() && CanCastInOrbwalk) { if (IsEOne) { if (E.GetTarget() != null && Player.Mana >= 70 && E.Cast()) { return; } } else { var e2Target = GameObjects.EnemyHeroes.Where(i => i.IsValidTarget(E2.Range) && HaveE(i)).ToList(); if ((e2Target.Any(i => CanE2(i) || Player.Distance(i) > i.GetRealAutoAttackRange() + 50) || e2Target.Count > 2 || Passive == -1) && E.Cast()) { return; } } } if (MainMenu["Orbwalk"]["W"] && W.IsReady() && CanCastInOrbwalk && Variables.TickCount - W.LastCastAttemptT >= 300 && !E.IsReady() && Passive == -1 && Orbwalker.GetTarget(OrbwalkingMode.Combo) != null && W.Cast()) { return; } var subTarget = W.GetTarget(); if (MainMenu["Orbwalk"]["Item"]) { UseItem(subTarget); } if (subTarget == null) { return; } if (MainMenu["Orbwalk"]["Ignite"] && Ignite.IsReady() && subTarget.HealthPercent < 30 && Player.Distance(subTarget) <= IgniteRange) { Player.Spellbook.CastSpell(Ignite, subTarget); } }