/// <summary> /// Checks if the orbwalker should wait to lasthit /// </summary> /// <returns><c>true</c> if should wait</returns> public bool ShouldWait() { if (m_towerTarget != null && m_towerTarget.IsValidTarget() && CanOrbwalkTarget(m_towerTarget) && !m_towerTarget.IsSiegeMinion()) { return(true); } var underTurret = ObjectManager.Get <Obj_AI_Turret>().FirstOrDefault(p => p.IsValidTarget() && p.Distance(ObjectManager.Player.ServerPosition) < 950f && p.IsAlly); if (underTurret != null) { return(ObjectManager.Get <Obj_AI_Minion>() .Any( minion => minion.IsValidTarget() && minion.Team != GameObjectTeam.Neutral && MinionManager.IsMinion(minion, false) && !minion.IsSiegeMinion() && underTurret.Distance(minion.ServerPosition) < 950f)); } if (m_fnShouldWait != null) { return(m_fnShouldWait()); } return (ObjectManager.Get <Obj_AI_Minion>() .Any( minion => minion.IsValidTarget() && minion.Team != GameObjectTeam.Neutral && Utility.InAARange(minion) && MinionManager.IsMinion(minion) && HealthPrediction.LaneClearHealthPrediction( minion, (int)(ObjectManager.Player.AttackDelay * 1000f * 2f + ObjectManager.Player.AttackCastDelay * 1000f), 30) <= Damage.AutoAttack.GetDamage(minion))); }
public bool ShouldWaitForMinion(float delay) { var minionListAA = ObjectManager.Get <Obj_AI_Minion>().Where(minion => minion.IsValidTarget() && minion.Team != GameObjectTeam.Neutral && Orbwalking.InAutoAttackRange(minion) && MinionManager.IsMinion(minion, false)); var minionsAlly = ObjectManager.Get <Obj_AI_Minion>().Where(minion => !minion.IsDead && minion.IsAlly && minion.Distance(Player) < 600 && MinionManager.IsMinion(minion, false)); int countAlly = minionsAlly.Count(); if (minionListAA.Count() == 1 && countAlly > 3 && minionListAA.Any(x => x.Health < Player.TotalAttackDamage * 2)) { return(true); } if (countAlly > 2 && minionListAA.Any(x => x.IsMoving && x.Health < Player.TotalAttackDamage * 2)) { return(true); } var t = (int)(Player.AttackCastDelay * 1000) - 20 + 1000 * (int)Math.Max(0, 500) / (int)Orbwalking.GetMyProjectileSpeed(); float laneClearDelay = delay * 1000 + t; return (ObjectManager.Get <Obj_AI_Minion>() .Any( minion => minion.IsValidTarget() && minion.Team != GameObjectTeam.Neutral && Orbwalking.InAutoAttackRange(minion) && MinionManager.IsMinion(minion, false) && HealthPrediction.LaneClearHealthPrediction(minion, (int)(laneClearDelay), 0) <= Player.GetAutoAttackDamage(minion))); }
private static void CastQ(Obj_AI_Hero target) { if (Menu.Item("QThroughMinions").IsActive()) { var prediction = Q.GetPrediction(target); var objects = prediction.CollisionObjects.OrderBy(x => x.Distance(Player)); var firstObj = objects.ElementAt(0); var secondObj = objects.ElementAt(1); if (firstObj == null) { return; } if ((firstObj.Type == GameObjectType.obj_AI_Hero && firstObj.IsValidTarget(Q.Range)) || (MinionManager.IsMinion(firstObj as Obj_AI_Minion) && secondObj.Type == GameObjectType.obj_AI_Hero && secondObj.IsValidTarget(Q.Range))) { Q.Cast(target); } } else { Q.Cast(target); } }
private static void LaneClear() { if (!Q.IsReady()) { return; } var minions = MinionManager.GetMinions(Q.Range); var killable = minions.FirstOrDefault(m => Q.GetDamage(m) > m.Health); if (killable != null) { CastQ(killable); return; } var unit = ObjectManager.Get <Obj_AI_Minion>() .FirstOrDefault( minion => MinionManager.IsMinion(minion) && minion.IsValidTarget(minion.HasUrgotEBuff() ? Q2.Range : Q.Range) && minion.Health <= Q.GetDamage(minion)); if (unit != null) { CastQ(unit, "LaneClear"); } }
private void CastQ(AIHeroClient target) { if (Spells[Q].IsReady() && target.IsValidEnemy(Qrange)) { UseQ(target, GetHitChance("Hitchance.Q"), YasuoMenu.getCheckBoxItem(YasuoMenu.ComboA, "Combo.UseQ"), YasuoMenu.getCheckBoxItem(YasuoMenu.ComboA, "Combo.UseQ2")); return; } if (YasuoMenu.getCheckBoxItem(YasuoMenu.ComboA, "Combo.StackQ") && !target.IsValidEnemy(Qrange) && !TornadoReady) { var bestmin = ObjectManager.Get <Obj_AI_Minion>() .Where(x => x.IsValidMinion(Qrange) && MinionManager.IsMinion(x)) .MinOrDefault(x => x.Distance(Yasuo)); if (bestmin != null) { var pred = Spells[Q].GetPrediction(bestmin); if (pred.Hitchance >= HitChance.Medium) { Spells[Q].Cast(bestmin.ServerPosition); } } } }
public static List <Obj_AI_Minion> GetMinions(Vector3 from, float range, MinionTypes type = MinionTypes.All, MinionTeam team = MinionTeam.Enemy, MinionOrderTypes order = MinionOrderTypes.Health) { var result = from minion in ObjectManager.Get <Obj_AI_Minion>() where minion.IsValidTarget(range, false, @from) let minionTeam = minion.Team where (team == MinionTeam.Neutral && minionTeam == GameObjectTeam.Neutral) || (team == MinionTeam.Ally && minionTeam == (myHero.Team == GameObjectTeam.Chaos ? GameObjectTeam.Chaos : GameObjectTeam.Order)) || (team == MinionTeam.Enemy && minionTeam == (myHero.Team == GameObjectTeam.Chaos ? GameObjectTeam.Order : GameObjectTeam.Chaos)) || (team == MinionTeam.NotAlly && minionTeam != myHero.Team) || (team == MinionTeam.NotAllyForEnemy && (minionTeam == myHero.Team || minionTeam == GameObjectTeam.Neutral)) || team == MinionTeam.All where (minion.IsMelee() && type == MinionTypes.Melee) || (!minion.IsMelee() && type == MinionTypes.Ranged) || type == MinionTypes.All where MinionManager.IsMinion(minion) || minionTeam == GameObjectTeam.Neutral || IsPet(minion) select minion; switch (order) { case MinionOrderTypes.Health: result = result.OrderBy(i => i.Health); break; case MinionOrderTypes.MaxHealth: result = result.OrderBy(i => i.MaxHealth).Reverse(); break; } return(result.ToList()); }
internal void CastQ(AIHeroClient target) { if (target != null && !target.IsInRange(Qrange)) { target = TargetSelector.GetTarget(Qrange, DamageType.Physical); } if (target != null) { if (Spells[Q].IsReady() && target.IsValidEnemy(Qrange)) { UseQ(target, GetHitChance("Hitchance.Q"), GetBool("Combo.UseQ", YasuoMenu.ComboM), GetBool("Combo.UseQ2", YasuoMenu.ComboM)); return; } if (GetBool("Combo.StackQ", YasuoMenu.ComboM) && !target.IsValidEnemy(Qrange) && !TornadoReady && !Yasuo.LSIsDashing() && !InDash) { var bestmin = ObjectManager.Get <Obj_AI_Minion>() .Where(x => x.IsValidMinion(Qrange) && MinionManager.IsMinion(x, false)) .MinOrDefault(x => x.LSDistance(Yasuo)); if (bestmin != null) { var pred = Spells[Q].GetPrediction(bestmin); if (pred.Hitchance >= HitChance.Medium) { Spells[Q].Cast(bestmin); } } } } }
public Obj_AI_Minion GetClosestEnemyMinion(Vector3?position = null) { var pos = position ?? ObjectHandler.Player.ServerPosition; return (EnemyMinions.OrderBy(x => x.Distance(pos, true)) .FirstOrDefault( minion => minion.IsValid && !minion.IsDead && minion.IsEnemy && MinionManager.IsMinion(minion))); }
public void UpdateMinions() { AllMinions = ObjectHandler.Get <Obj_AI_Minion>().ToList(); AllyMinions = AllMinions.FindAll( minion => minion.IsValid && !minion.IsDead && minion.IsAlly && MinionManager.IsMinion(minion)); EnemyMinions = AllMinions.FindAll( minion => minion.IsValid && !minion.IsDead && minion.IsEnemy && MinionManager.IsMinion(minion)); }
//E buff : YasuoDashWrapper public static List <Obj_AI_Base> GetETargets() { var targets = new List <Obj_AI_Base>(); targets.AddRange(HeroManager.Enemies.Where(x => x.IsValidTarget() && !x.HasBuff("YasuoDashWrapper") && BadaoMainVariables.E.IsInRange(x)).ToList()); targets.AddRange(ObjectManager.Get <Obj_AI_Minion>().Where(x => x.IsValidTarget(BadaoMainVariables.E.Range) && !MinionManager.IsWard(x as Obj_AI_Minion) && x.Team != GameObjectTeam.Unknown) .Where(x => MinionManager.IsMinion(x) || x.Team == GameObjectTeam.Neutral).Where(x => !x.HasBuff("YasuoDashWrapper"))); return(targets.ToList()); }
/// <summary> /// Determines if the orbwalker should wait before attacking a minion. /// </summary> /// <returns><c>true</c> if the orbwalker should wait before attacking a minion, <c>false</c> otherwise.</returns> private bool ShouldWait() { return (ObjectManager.Get <Obj_AI_Minion>() .Any( minion => minion.IsValidTarget() && minion.Team != GameObjectTeam.Neutral && InAutoAttackRange(minion) && MinionManager.IsMinion(minion, false) && HealthPrediction.LaneClearHealthPrediction( minion, (int)((_player.AttackDelay * 1000) * LaneClearWaitTimeMod), FarmDelay) <= _player.GetAutoAttackDamage(minion))); }
private bool ShouldAttackMinion(Obj_AI_Minion minion) { if (minion.Name == "WardCorpse" || minion.CharData.BaseSkinName == "jarvanivstandard") { return(false); } if (MinionManager.IsWard(minion)) { return(Menu.Item("AttackWards").IsActive()); } return((Menu.Item("AttackPetsnTraps").GetValue <bool>() || MinionManager.IsMinion(minion)) && minion.CharData.BaseSkinName != "gangplankbarrel"); }
/// <summary> /// Returns if a minion should be attacked /// </summary> /// <param name="minion">The <see cref="Obj_AI_Minion" /></param> /// <param name="includeBarrel">Include Gangplank Barrel</param> /// <returns><c>true</c> if the minion should be attacked; otherwise, <c>false</c>.</returns> private static bool ShouldAttackMinion(Obj_AI_Minion minion) { if (minion.Name == "WardCorpse" || minion.CharData.BaseSkinName == "jarvanivstandard") { return(false); } if (MinionManager.IsWard(minion)) { return(true); } return((true || MinionManager.IsMinion(minion)) && minion.CharData.BaseSkinName != "gangplankbarrel"); }
private static void GameObject_OnCreate(GameObject sender, EventArgs args) { var unit = sender as Obj_AI_Minion; if (unit == null || !unit.IsValid) { return; } if (Program.Config.Item("Minions").IsActive() && MinionManager.IsMinion(unit)) { var index = MinionSkins[Program.Config.Item("MinionType").GetValue <StringList>().SelectedValue]; unit.SetSkin(unit.CharData.BaseSkinName, index, 100); return; } var name = unit.CharData.BaseSkinName.ToLower(); if (Program.Config.Item("Ward").IsActive() && name.Contains("ward") || name.Equals("yellowtrinket")) { var index = Convert.ToInt32(Program.Config.Item("WardIndex").GetValue <StringList>().SelectedValue); Utility.DelayAction.Add( 50, () => { if (Program.Config.Item("WardOwn").IsActive() && !unit.Buffs.Any(b => b.SourceName.Equals(ObjectManager.Player.ChampionName))) { return; } unit.SetSkin(unit.CharData.BaseSkinName, index); }); } // ObjectList.RemoveAll(obj => !obj.IsValid); /*var unit = sender as Obj_AI_Base; * * if (unit == null || !unit.IsValid) * { * return; * } * ObjectList.Add(unit.NetworkId, new Model(unit.CharData.BaseSkinName, unit.BaseSkinId)); * */ }
public bool ShouldWait() { if (m_fnShouldWait != null) { return(m_fnShouldWait()); } if (m_towerTarget != null && m_towerTarget.IsValidTarget() && CanOrbwalkTarget(m_towerTarget) && GetTowerMinion() != -1) { return(true); } return (ObjectManager.Get <Obj_AI_Minion>() .Any( minion => (minion.IsValidTarget() && minion.Team != GameObjectTeam.Neutral && Utility.InAARange(minion) && MinionManager.IsMinion(minion, false) && (minion.Health - Damage.Prediction.GetPrediction(minion, ObjectManager.Player.AttackDelay * 1000f * 2f, true) <= Damage.AutoAttack.GetDamage(minion, true) * (int)(Math.Ceiling(Damage.Prediction.AggroCount(minion) / 2f)))))); }
private static void LaneClear() { if (!Q.IsReady()) { return; } var unit = ObjectManager.Get <Obj_AI_Minion>() .FirstOrDefault( minion => MinionManager.IsMinion(minion) && minion.IsValidTarget(minion.HasBuff("urgotcorrosivedebuff", true) ? Q2.Range : Q.Range) && minion.Health <= Q.GetDamage(minion)); if (unit != null) { CastQ(unit, "LaneClear"); } }
private static void WaveClear() { var minions = ObjectManager.Get <Obj_AI_Minion>() .Where( m => m.IsValidTarget(Spells[SpellSlot.Q].Range) && m.IsMinion && MinionManager.IsMinion(m)); if (SpellSlot.Q.IsReady() && Misc.Active("Farm.UseQ")) { MinionManager.FarmLocation QLocation = MinionManager.GetBestCircularFarmLocation( minions.Select(m => m.ServerPosition.To2D()).ToList(), Spells[SpellSlot.Q].Width, Spells[SpellSlot.Q].Range); if (QLocation.MinionsHit >= 1) { Spells[SpellSlot.Q].Cast(QLocation.Position); } } }
private bool ShouldAttackMinion(Obj_AI_Base minion, bool includeBarrel = false) { if (minion.Name == "WardCorpse" || minion.CharData.BaseSkinName == "jarvanivstandard") { return(false); } if (minion.Team == GameObjectTeam.Neutral && includeBarrel) { return(true && minion.CharData.BaseSkinName == "gangplankbarrel" && minion.IsHPBarRendered); } var minion2 = minion as Obj_AI_Minion; if (MinionManager.IsWard(minion2)) { return(false); } return((true || MinionManager.IsMinion(minion2)) && minion.CharData.BaseSkinName != "gangplankbarrel"); }
/// <summary> /// Called when the unit launches an auto attack missile. /// </summary> /// <param name="unit">The unit.</param> /// <param name="target">The target.</param> private static void Orbwalking_OnAttack(AttackableUnit unit, AttackableUnit target) { if (!unit.IsMe || !Q.IsReady() || Orbwalker.ActiveMode == Orbwalking.OrbwalkingMode.None) { return; } if ((Orbwalker.ActiveMode == Orbwalking.OrbwalkingMode.Combo && !GetValue <bool>("UseQCombo")) || (Orbwalker.ActiveMode == Orbwalking.OrbwalkingMode.Mixed && !GetValue <bool>("UseQHarass")) || (Orbwalker.ActiveMode == Orbwalking.OrbwalkingMode.LaneClear && !GetValue <bool>("UseQWaveClear"))) { return; } var minion = target as Obj_AI_Minion; if (minion != null && Orbwalker.ActiveMode != Orbwalking.OrbwalkingMode.LaneClear) { if (!MinionManager.IsMinion(minion)) { return; } } if (!(target is Obj_AI_Hero) && Orbwalker.ActiveMode != Orbwalking.OrbwalkingMode.LaneClear) { return; } Utility.DelayAction.Add( (int)(Player.AttackCastDelay * 1000 + Game.Ping / 2f), () => { Q.Cast(Game.CursorPos); Orbwalking.ResetAutoAttackTimer(); Orbwalker.ForceTarget((Obj_AI_Base)target); }); }
private bool ShouldWaitUnderTurret(Obj_AI_Minion noneKillableMinion) { return(Get <Obj_AI_Minion>().Any(minion => { if (minion == null) { throw new ArgumentNullException(nameof(minion)); } return (noneKillableMinion == null || noneKillableMinion.NetworkId != minion.NetworkId) && minion.IsValidTarget() && minion.Team != GameObjectTeam.Neutral && InAutoAttackRange(minion) && MinionManager.IsMinion(minion) && HealthPrediction.LaneClearHealthPrediction(minion, (int) (player.AttackDelay * 1000 + (player.IsMelee ? player.AttackCastDelay * 1000 : player.AttackCastDelay *1000 + 1000 *(player.AttackRange + 2 * player.BoundingRadius) / player.BasicAttack.MissileSpeed)), FarmDelay) <= player.GetAutoAttackDamage(minion); })); }
/// <summary> /// Gets the target. /// </summary> /// <returns>AttackableUnit.</returns> public virtual AttackableUnit GetTarget() { AttackableUnit result = null; if ((ActiveMode == OrbwalkingMode.Mixed || ActiveMode == OrbwalkingMode.LaneClear) && !_config.Item("PriorizeFarm").GetValue <bool>()) { var target = TargetSelector.GetTarget(-1, TargetSelector.DamageType.Physical); if (target != null && InAutoAttackRange(target)) { return(target); } } /*Killable Minion*/ if (ActiveMode == OrbwalkingMode.LaneClear || (ActiveMode == OrbwalkingMode.Mixed && _config.Item("LWH").GetValue <bool>()) || ActiveMode == OrbwalkingMode.LastHit) { var minionList = ObjectManager.Get <Obj_AI_Minion>() .Where( minion => minion.IsValidTarget() && InAutoAttackRange(minion)) .OrderByDescending(minion => minion.CharData.BaseSkinName.Contains("Siege")) .ThenBy(minion => minion.CharData.BaseSkinName.Contains("Super")) .ThenBy(minion => minion.Health) .ThenByDescending(minion => minion.MaxHealth); foreach (var minion in minionList) { var t = (int)(_player.AttackCastDelay * 1000) - 100 + Game.Ping / 2 + 1000 * (int)Math.Max(0, _player.Distance(minion) - _player.BoundingRadius) / int.MaxValue; var predHealth = HealthPrediction.GetHealthPrediction(minion, t, FarmDelay); if (minion.Team != GameObjectTeam.Neutral && (_config.Item("AttackPetsnTraps").GetValue <bool>() && minion.CharData.BaseSkinName != "jarvanivstandard" || MinionManager.IsMinion(minion, _config.Item("AttackWards").GetValue <bool>()))) { if (predHealth <= 0) { FireOnNonKillableMinion(minion); } if (predHealth > 0 && predHealth <= _player.GetAutoAttackDamage(minion, true)) { return(minion); } } if (minion.Team == GameObjectTeam.Neutral && (_config.Item("AttackBarrel").GetValue <bool>() && minion.CharData.BaseSkinName == "gangplankbarrel" && minion.IsHPBarRendered)) { if (minion.Health < 2) { return(minion); } } } } //Forced target if (_forcedTarget.IsValidTarget() && InAutoAttackRange(_forcedTarget)) { return(_forcedTarget); } /* turrets / inhibitors / nexus */ if (ActiveMode == OrbwalkingMode.LaneClear && (!_config.Item("FocusMinionsOverTurrets").GetValue <KeyBind>().Active || !MinionManager.GetMinions(ObjectManager.Player.Position, GetRealAutoAttackRange(ObjectManager.Player)).Any())) { /* turrets */ foreach (var turret in ObjectManager.Get <Obj_AI_Turret>().Where(t => t.IsValidTarget() && InAutoAttackRange(t))) { return(turret); } /* inhibitor */ foreach (var turret in ObjectManager.Get <Obj_BarracksDampener>().Where(t => t.IsValidTarget() && InAutoAttackRange(t))) { return(turret); } /* nexus */ foreach (var nexus in ObjectManager.Get <Obj_HQ>().Where(t => t.IsValidTarget() && InAutoAttackRange(t))) { return(nexus); } } /*Champions*/ if (ActiveMode != OrbwalkingMode.LastHit) { var target = TargetSelector.GetTarget(-1, TargetSelector.DamageType.Physical); if (target.IsValidTarget() && InAutoAttackRange(target)) { return(target); } } /*Jungle minions*/ if (ActiveMode == OrbwalkingMode.LaneClear || ActiveMode == OrbwalkingMode.Mixed) { var jminions = ObjectManager.Get <Obj_AI_Minion>() .Where( mob => mob.IsValidTarget() && mob.Team == GameObjectTeam.Neutral && this.InAutoAttackRange(mob) && mob.CharData.BaseSkinName != "gangplankbarrel"); result = _config.Item("Smallminionsprio").GetValue <bool>() ? jminions.MinOrDefault(mob => mob.MaxHealth) : jminions.MaxOrDefault(mob => mob.MaxHealth); if (result != null) { return(result); } } /*Lane Clear minions*/ if (ActiveMode == OrbwalkingMode.LaneClear) { if (!ShouldWait()) { if (_prevMinion.IsValidTarget() && InAutoAttackRange(_prevMinion)) { var predHealth = HealthPrediction.LaneClearHealthPrediction( _prevMinion, (int)((_player.AttackDelay * 1000) * LaneClearWaitTimeMod), FarmDelay); if (predHealth >= 2 * _player.GetAutoAttackDamage(_prevMinion) || Math.Abs(predHealth - _prevMinion.Health) < float.Epsilon) { return(_prevMinion); } } result = (from minion in ObjectManager.Get <Obj_AI_Minion>() .Where(minion => minion.IsValidTarget() && InAutoAttackRange(minion) && (_config.Item("AttackWards").GetValue <bool>() || !MinionManager.IsWard(minion)) && (_config.Item("AttackPetsnTraps").GetValue <bool>() && minion.CharData.BaseSkinName != "jarvanivstandard" || MinionManager.IsMinion(minion, _config.Item("AttackWards").GetValue <bool>())) && minion.CharData.BaseSkinName != "gangplankbarrel") let predHealth = HealthPrediction.LaneClearHealthPrediction( minion, (int)((_player.AttackDelay * 1000) * LaneClearWaitTimeMod), FarmDelay) where predHealth >= 2 * _player.GetAutoAttackDamage(minion) || Math.Abs(predHealth - minion.Health) < float.Epsilon select minion).MaxOrDefault(m => !MinionManager.IsMinion(m, true) ? float.MaxValue : m.Health); if (result != null) { _prevMinion = (Obj_AI_Minion)result; } } } return(result); }
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: var minions = new List <Obj_AI_Minion>(); minions.AddRange( ObjectManager.Get <Obj_AI_Minion>() .Where(x => x.Team == GameObjectTeam.Neutral) .Where(i => i.IsValidTarget(1200, true, from.To3D()))); minions.AddRange( ObjectManager.Get <Obj_AI_Minion>() .Where( i => i.IsValidTarget(1200, false, @from.To3D()) && (skillshot.Unit.Team == ObjectManager.Player.Team ? i.Team != ObjectManager.Player.Team : i.Team == ObjectManager.Player.Team) && MinionManager.IsMinion(i))); collisions.AddRange( from minion in minions let pred = FastPrediction( @from, minion, Math.Max( 0, skillshot.SpellData.Delay - (Utils.GameTimeTickCount - skillshot.StartTick)), skillshot.SpellData.MissileSpeed) let pos = pred.PredictedPos let w = skillshot.SpellData.RawRadius + (!pred.IsMoving ? minion.BoundingRadius - 15 : 0) - pos.LSDistance(@from, skillshot.End, true) where w > 0 select new DetectedCollision { Position = pos.ProjectOn(skillshot.End, skillshot.Start).LinePoint + skillshot.Direction * 30, Unit = minion, Type = CollisionObjectTypes.Minion, Distance = pos.LSDistance(@from), Diff = w }); break; case CollisionObjectTypes.Champion: collisions.AddRange( from hero in HeroManager.Allies.Where(i => i.IsValidTarget(1200, false) && !i.IsMe) let pred = FastPrediction( @from, hero, Math.Max( 0, skillshot.SpellData.Delay - (Utils.GameTimeTickCount - skillshot.StartTick)), skillshot.SpellData.MissileSpeed) let pos = pred.PredictedPos let w = skillshot.SpellData.RawRadius + 30 - pos.LSDistance(@from, skillshot.End, true) where w > 0 select new DetectedCollision { Position = pos.ProjectOn(skillshot.End, skillshot.Start).LinePoint + skillshot.Direction * 30, Unit = hero, Type = CollisionObjectTypes.Minion, Distance = pos.LSDistance(@from), Diff = w }); break; case CollisionObjectTypes.YasuoWall: if ( !HeroManager.Allies.Any( i => i.IsValidTarget(float.MaxValue, false) && i.ChampionName == "Yasuo")) { break; } GameObject wall = null; foreach (var gameObject in ObjectManager.Get <GameObject>() .Where( i => i.IsValid && Regex.IsMatch(i.Name, "_w_windwall.\\.troy", 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() - wallCastedPos).Normalized().Perpendicular(); var wallStart = wall.Position.To2D() + wallWidth / 2f * wallDirection; var wallEnd = wallStart - wallWidth * wallDirection; var wallPolygon = new Geometry.Rectangle(wallStart, wallEnd, 75).ToPolygon(); 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(item => item.LSDistance(@from)).ToList()[0]; var collisionT = Utils.GameTimeTickCount + Math.Max( 0, skillshot.SpellData.Delay - (Utils.GameTimeTickCount - skillshot.StartTick)) + 100 + 1000 * intersection.LSDistance(@from) / skillshot.SpellData.MissileSpeed; if (collisionT - wallCastT < 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 : Vector2.Zero); }
internal static bool IsValidMinion(this Obj_AI_Minion minion, float range = 2000) { if (minion == null) { return(false); } var name = minion.CharData.BaseSkinName.ToLower(); return(Player.Distance(minion) <= range && minion.IsValid && minion.IsTargetable && !minion.IsInvulnerable && minion.IsVisible && minion.Team != Player.Team && minion.IsHPBarRendered && (MinionManager.IsMinion(minion) || minion.Team == GameObjectTeam.Neutral && minion.MaxHealth > 5) && !name.Contains("gangplankbarrel")); }
public static bool IsWard(Obj_AI_Minion obj) { return(obj.Team != GameObjectTeam.Neutral && !MinionManager.IsMinion(obj) && !IsPet(obj) && MinionManager.IsMinion(obj, true)); }
public static bool IsSmiteable(Obj_AI_Minion obj) { return(MinionManager.IsMinion(obj) || obj.Team == GameObjectTeam.Neutral || IsPet(obj)); }
public override AttackableUnit GetTarget() { AttackableUnit result; if (ActiveMode == Orbwalking.OrbwalkingMode.LaneClear || ActiveMode == Orbwalking.OrbwalkingMode.Mixed || ActiveMode == Orbwalking.OrbwalkingMode.LastHit) { foreach (var minion in ObjectManager.Get <Obj_AI_Minion>() .Where( minion => minion.IsValidTarget() && minion.Health < 3 * (ObjectManager.Player.BaseAttackDamage + ObjectManager.Player.FlatPhysicalDamageMod)) ) { var r = CustomInAutoattackRange(minion); if (r != 0) { var t = (int)(Program.Player.AttackCastDelay * 1000) - 100 + Game.Ping / 2; var predHealth = HealthPrediction.GetHealthPrediction(minion, t, 0); var damage = (r == 1) ? Program.Player.GetAutoAttackDamage(minion, true) : Program.Player.GetSpellDamage(minion, SpellSlot.W); if (minion.Team != GameObjectTeam.Neutral && MinionManager.IsMinion(minion, true)) { if (predHealth > 0 && predHealth <= damage) { return(minion); } } } } } if (ActiveMode != Orbwalking.OrbwalkingMode.LastHit) { var posibleTargets = new Dictionary <Obj_AI_Base, float>(); var autoAttackTarget = TargetSelector.GetTarget(-1, TargetSelector.DamageType.Physical); if (autoAttackTarget.IsValidTarget()) { posibleTargets.Add(autoAttackTarget, GetDamageValue(autoAttackTarget, false)); } foreach (var soldier in SoldiersManager.ActiveSoldiers) { var soldierTarget = TargetSelector.GetTarget(_soldierAARange + 65 + 65, TargetSelector.DamageType.Magical, true, null, soldier.ServerPosition); if (soldierTarget.IsValidTarget()) { if (posibleTargets.ContainsKey(soldierTarget)) { posibleTargets[soldierTarget] *= 1.25f; } else { posibleTargets.Add(soldierTarget, GetDamageValue(soldierTarget, true)); } } } if (posibleTargets.Count > 0) { return(posibleTargets.MinOrDefault(p => p.Value).Key); } var soldiers = SoldiersManager.ActiveSoldiers; if (soldiers.Count > 0) { var minions = MinionManager.GetMinions(1100, MinionTypes.All, MinionTeam.NotAlly); var validEnemiesPosition = HeroManager.Enemies.Where(e => e.IsValidTarget(1100)).Select(e => e.ServerPosition.To2D()).ToList(); const int AAWidthSqr = 100 * 100; //Try to harass using minions foreach (var soldier in soldiers) { foreach (var minion in minions) { var soldierAArange = _soldierAARange + 65 + minion.BoundingRadius; soldierAArange *= soldierAArange; if (soldier.Distance(minion, true) < soldierAArange) { var p1 = minion.Position.To2D(); var p2 = soldier.Position.To2D().Extend(minion.Position.To2D(), 400); foreach (var enemyPosition in validEnemiesPosition) { if (enemyPosition.Distance(p1, p2, true, true) < AAWidthSqr) { return(minion); } } } } } } } /* turrets / inhibitors / nexus */ if (ActiveMode == Orbwalking.OrbwalkingMode.LaneClear) { /* turrets */ foreach (var turret in ObjectManager.Get <Obj_AI_Turret>().Where(t => t.IsValidTarget() && Orbwalking.InAutoAttackRange(t))) { return(turret); } /* inhibitor */ foreach (var turret in ObjectManager.Get <Obj_BarracksDampener>().Where(t => t.IsValidTarget() && Orbwalking.InAutoAttackRange(t))) { return(turret); } /* nexus */ foreach (var nexus in ObjectManager.Get <Obj_HQ>().Where(t => t.IsValidTarget() && Orbwalking.InAutoAttackRange(t))) { return(nexus); } } /*Jungle minions*/ if (ActiveMode == Orbwalking.OrbwalkingMode.LaneClear || ActiveMode == Orbwalking.OrbwalkingMode.Mixed) { result = ObjectManager.Get <Obj_AI_Minion>() .Where( mob => mob.IsValidTarget() && Orbwalking.InAutoAttackRange(mob) && mob.Team == GameObjectTeam.Neutral) .MaxOrDefault(mob => mob.MaxHealth); if (result != null) { return(result); } } if (ActiveMode == Orbwalking.OrbwalkingMode.LaneClear) { return((ObjectManager.Get <Obj_AI_Minion>().Where(minion => minion.IsValidTarget() && InAutoAttackRange(minion))).MaxOrDefault(m => CustomInAutoattackRange(m) * m.Health)); } return(null); }
void Flee() { Orbwalker.DisableAttacking = true; // BERB if (GetBool("Flee.UseQ2", YasuoMenu.MiscM) && !Yasuo.LSIsDashing() && SpellSlot.Q.IsReady() && TornadoReady) { var qtarg = TargetSelector.GetTarget(Spells[Q2].Range, DamageType.Physical); if (qtarg != null) { Spells[Q2].Cast(qtarg.ServerPosition); } } if (FleeMode == FleeType.ToCursor) { Orbwalker.OrbwalkTo(Game.CursorPos); var smart = GetBool("Flee.Smart", YasuoMenu.MiscM); if (Spells[E].IsReady()) { if (smart) { Obj_AI_Base dashTarg; if (Yasuo.ServerPosition.PointUnderEnemyTurret()) { var closestturret = ObjectManager.Get <Obj_AI_Turret>() .Where(x => x.IsEnemy) .MinOrDefault(y => y.LSDistance(Yasuo)); var potential = ObjectManager.Get <Obj_AI_Base>() .Where(x => x.IsDashable()) .MaxOrDefault(x => GetDashPos(x).LSDistance(closestturret)); if (potential != null) { var gdpos = GetDashPos(potential); if (gdpos.LSDistance(Game.CursorPos) < Yasuo.LSDistance(Game.CursorPos) && gdpos.LSDistance(closestturret.Position) - closestturret.BoundingRadius > Yasuo.LSDistance(closestturret.Position) - Yasuo.BoundingRadius) { Spells[E].Cast(potential); } } } dashTarg = ObjectManager.Get <Obj_AI_Base>() .Where(x => x.IsDashable()) .MinOrDefault(x => GetDashPos(x).LSDistance(Game.CursorPos)); if (dashTarg != null) { var posafdash = GetDashPos(dashTarg); if (posafdash.LSDistance(Game.CursorPos) < Yasuo.LSDistance(Game.CursorPos) && !posafdash.PointUnderEnemyTurret()) { Spells[E].CastOnUnit(dashTarg); } } } else { var dashtarg = ObjectManager.Get <Obj_AI_Minion>() .Where(x => x.IsDashable()) .MinOrDefault(x => GetDashPos(x).LSDistance(Game.CursorPos)); if (dashtarg != null) { Spells[E].CastOnUnit(dashtarg); } } } if (GetBool("Flee.StackQ", YasuoMenu.MiscM) && SpellSlot.Q.IsReady() && !TornadoReady && !Yasuo.LSIsDashing()) { Obj_AI_Minion qtarg = null; if (!Spells[E].IsReady()) { qtarg = ObjectManager.Get <Obj_AI_Minion>() .Find(x => x.LSIsValidTarget(Spells[Q].Range) && MinionManager.IsMinion(x)); } else { var etargs = ObjectManager.Get <Obj_AI_Minion>() .Where( x => x.LSIsValidTarget(Spells[E].Range) && MinionManager.IsMinion(x) && x.IsDashable()); if (!etargs.Any()) { qtarg = ObjectManager.Get <Obj_AI_Minion>() .Find(x => x.LSIsValidTarget(Spells[Q].Range) && MinionManager.IsMinion(x)); } } if (qtarg != null) { Spells[Q].Cast(qtarg); } } } if (FleeMode == FleeType.ToNexus) { var nexus = shop; if (nexus != null) { Orbwalker.OrbwalkTo(nexus.Position); var bestminion = ObjectManager.Get <Obj_AI_Base>().Where(x => x.IsDashable()).MinOrDefault(x => GetDashPos(x).LSDistance(nexus.Position)); if (bestminion != null && (!GetBool("Flee.Smart", YasuoMenu.MiscM) || GetDashPos(bestminion).LSDistance(nexus.Position) < Yasuo.LSDistance(nexus.Position))) { Spells[E].CastOnUnit(bestminion); if (GetBool("Flee.StackQ", YasuoMenu.MiscM) && SpellSlot.Q.IsReady() && !TornadoReady) { Spells[Q].Cast(bestminion); } } } } if (FleeMode == FleeType.ToAllies) { Obj_AI_Base bestally = HeroManager.Allies.Where(x => !x.IsMe && x.LSCountEnemiesInRange(300) == 0).MinOrDefault(x => x.LSDistance(Yasuo)); if (bestally == null) { bestally = ObjectManager.Get <Obj_AI_Minion>() .Where(x => x.IsValidAlly(3000)) .MinOrDefault(x => x.LSDistance(Yasuo)); } if (bestally != null) { Orbwalker.OrbwalkTo(bestally.ServerPosition); if (Spells[E].IsReady()) { var besttarget = ObjectManager.Get <Obj_AI_Base>() .Where(x => x.IsDashable()) .MinOrDefault(x => GetDashPos(x).LSDistance(bestally.ServerPosition)); if (besttarget != null) { Spells[E].CastOnUnit(besttarget); if (GetBool("Flee.StackQ", YasuoMenu.MiscM) && SpellSlot.Q.IsReady() && !TornadoReady) { Spells[Q].Cast(besttarget); } } } } else { var nexus = shop; if (nexus != null) { Orbwalker.OrbwalkTo(nexus.Position); var bestminion = ObjectManager.Get <Obj_AI_Base>().Where(x => x.IsDashable()).MinOrDefault(x => GetDashPos(x).LSDistance(nexus.Position)); if (bestminion != null && GetDashPos(bestminion).LSDistance(nexus.Position) < Yasuo.LSDistance(nexus.Position)) { Spells[E].CastOnUnit(bestminion); } } } } }
public virtual AttackableUnit GetTarget() { AttackableUnit result = null; if ((ActiveMode == OrbwalkingMode.Mixed || ActiveMode == OrbwalkingMode.LaneClear) && !_config.Item("PriorizeFarm").GetValue <bool>()) { var target = TargetSelector.GetTarget(-1, LeagueSharp.Common.TargetSelector.DamageType.Physical); if (target != null) { return(target); } } /*Killable Minion*/ if (ActiveMode == OrbwalkingMode.LaneClear || ActiveMode == OrbwalkingMode.Mixed || ActiveMode == OrbwalkingMode.LastHit) { foreach (var minion in ObjectManager.Get <Obj_AI_Minion>() .Where( minion => minion.IsValidTarget() && InAutoAttackRange(minion) && minion.Health < 2 * (ObjectManager.Player.BaseAttackDamage + ObjectManager.Player.FlatPhysicalDamageMod)) ) { var t = (int)(Player.AttackCastDelay * 1000) - 100 + Game.Ping / 2 + 1000 * (int)Player.Distance(minion) / (int)GetMyProjectileSpeed(); var predHealth = HealthPrediction.GetHealthPrediction(minion, t, FarmDelay); if (minion.Team != GameObjectTeam.Neutral && MinionManager.IsMinion(minion, true)) { if (predHealth <= 0) { FireOnNonKillableMinion(minion); } if (predHealth > 0 && predHealth <= Player.GetAutoAttackDamage(minion, true)) { return(minion); } } } } //Forced target if (_forcedTarget.IsValidTarget() && InAutoAttackRange(_forcedTarget)) { return(_forcedTarget); } /* turrets / inhibitors / nexus */ if (ActiveMode == OrbwalkingMode.LaneClear) { /* turrets */ foreach (var turret in ObjectManager.Get <Obj_AI_Turret>().Where(t => t.IsValidTarget() && InAutoAttackRange(t))) { return(turret); } /* inhibitor */ foreach (var turret in ObjectManager.Get <Obj_BarracksDampener>().Where(t => t.IsValidTarget() && InAutoAttackRange(t))) { return(turret); } /* nexus */ foreach (var nexus in ObjectManager.Get <Obj_HQ>().Where(t => t.IsValidTarget() && InAutoAttackRange(t))) { return(nexus); } } /*Champions*/ if (ActiveMode != OrbwalkingMode.LastHit) { if (ObjectManager.Player.BaseSkinName == "Vayne") { var attackableHeroes = HeroManager.Enemies.FindAll(h => !h.IsDead && h.IsValidTarget(Player.AttackRange)); if (attackableHeroes.Any()) { if (Mouse.LeftButton == MouseButtonState.Pressed) { DesiredTarget = attackableHeroes.OrderBy(h => h.Distance(Game.CursorPos)).FirstOrDefault(); } if (DesiredTarget != null) { if (DesiredTarget.IsValidTarget()) { return(DesiredTarget); } if (DesiredTarget.IsDead || Player.Distance(DesiredTarget) >= 1000) { DesiredTarget = null; } } var EZKill = attackableHeroes.FirstOrDefault( h => h.Health < Player.GetAutoAttackDamage(h) * 3 + Player.GetSpellDamage(h, LeagueSharp.SpellSlot.W)); if (EZKill != null) { return(EZKill); } var TwoWStacks = attackableHeroes.FirstOrDefault(h => h.VayneWStacks() == 2); if (TwoWStacks != null) { return(TwoWStacks); } var priorityTarget = attackableHeroes.FirstOrDefault(h => Lists.TargetSelector.Contains(h.BaseSkinName)); if (priorityTarget != null) { return(priorityTarget); } if (Items.HasItem((int)ItemId.The_Bloodthirster, Player) && Player.HealthPercent < 30) { return(attackableHeroes.OrderBy(h => h.Armor).FirstOrDefault()); } return(attackableHeroes.OrderBy(h => h.Health).FirstOrDefault()); } } var target = TargetSelector.GetTarget(-1, LeagueSharp.Common.TargetSelector.DamageType.Physical); if (target.IsValidTarget()) { return(target); } } /*Jungle minions*/ if (ActiveMode == OrbwalkingMode.LaneClear || ActiveMode == OrbwalkingMode.Mixed) { result = ObjectManager.Get <Obj_AI_Minion>() .Where( mob => mob.IsValidTarget() && InAutoAttackRange(mob) && mob.Team == GameObjectTeam.Neutral) .MaxOrDefault(mob => mob.MaxHealth); if (result != null) { return(result); } } /*Lane Clear minions*/ if (ActiveMode == OrbwalkingMode.LaneClear) { if (!ShouldWait()) { if (_prevMinion.IsValidTarget() && InAutoAttackRange(_prevMinion)) { var predHealth = HealthPrediction.LaneClearHealthPrediction( _prevMinion, (int)((Player.AttackDelay * 1000) * LaneClearWaitTimeMod), FarmDelay); if (predHealth >= 2 * Player.GetAutoAttackDamage(_prevMinion) || Math.Abs(predHealth - _prevMinion.Health) < float.Epsilon) { return(_prevMinion); } } result = (from minion in ObjectManager.Get <Obj_AI_Minion>() .Where(minion => minion.IsValidTarget() && InAutoAttackRange(minion)) let predHealth = HealthPrediction.LaneClearHealthPrediction( minion, (int)((Player.AttackDelay * 1000) * LaneClearWaitTimeMod), FarmDelay) where predHealth >= 2 * Player.GetAutoAttackDamage(minion) || Math.Abs(predHealth - minion.Health) < float.Epsilon select minion).MaxOrDefault(m => m.Health); if (result != null) { _prevMinion = (Obj_AI_Minion)result; } } } return(result); }
public virtual AttackableUnit GetTarget() { AttackableUnit result = null; if ((ActiveMode == OrbwalkingMode.Mixed || ActiveMode == OrbwalkingMode.LaneClear) && !_config.Item("PriorizeFarm").GetValue <bool>()) { var target = TargetSelector.GetTarget(-1, TargetSelector.DamageType.Physical); if (target != null) { return(target); } } /*Killable Minion*/ if (ActiveMode == OrbwalkingMode.LaneClear || ActiveMode == OrbwalkingMode.Mixed || ActiveMode == OrbwalkingMode.LastHit) { var MinionList = ObjectManager.Get <Obj_AI_Minion>() .Where( minion => minion.IsValidTarget() && InAutoAttackRange(minion) && minion.Health < 2 * (ObjectManager.Player.BaseAttackDamage + ObjectManager.Player.FlatPhysicalDamageMod)).OrderByDescending(minion => minion.MaxHealth); foreach (var minion in MinionList) { var t = (int)(Player.AttackCastDelay * 1000) - 100 + Game.Ping / 2 + 1000 * (int)Player.ServerPosition.Distance(minion.ServerPosition) / (int)GetMyProjectileSpeed(); var predHealth = HealthPrediction.GetHealthPrediction(minion, t, FarmDelay); if (minion.Team != GameObjectTeam.Neutral && MinionManager.IsMinion(minion, true)) { if (predHealth <= 0) { FireOnNonKillableMinion(minion); } if (predHealth > 0 && predHealth <= GetAADamage(minion)) { return(minion); } } } } //Forced target if (_forcedTarget.IsValidTarget() && InAutoAttackRange(_forcedTarget)) { return(_forcedTarget); } /* turrets / inhibitors / nexus */ if (ActiveMode == OrbwalkingMode.LaneClear) { /* turrets */ foreach (var turret in ObjectManager.Get <Obj_AI_Turret>().Where(t => t.IsValidTarget() && InAutoAttackRange(t))) { return(turret); } /* inhibitor */ foreach (var turret in ObjectManager.Get <Obj_BarracksDampener>().Where(t => t.IsValidTarget() && InAutoAttackRange(t))) { return(turret); } /* nexus */ foreach (var nexus in ObjectManager.Get <Obj_HQ>().Where(t => t.IsValidTarget() && InAutoAttackRange(t))) { return(nexus); } } /*Champions*/ if (ActiveMode != OrbwalkingMode.LastHit) { var target = TargetSelector.GetTarget(-1, TargetSelector.DamageType.Physical); if (target.IsValidTarget()) { return(target); } } /*Jungle minions*/ if (ActiveMode == OrbwalkingMode.LaneClear || ActiveMode == OrbwalkingMode.Mixed) { result = ObjectManager.Get <Obj_AI_Minion>() .Where( mob => mob.IsValidTarget() && mob.Team == GameObjectTeam.Neutral && InAutoAttackRange(mob) && mob.CharData.BaseSkinName != "gangplankbarrel") .MaxOrDefault(mob => mob.MaxHealth); if (result != null) { return(result); } } /*Lane Clear minions*/ if (ActiveMode == OrbwalkingMode.LaneClear) { if (!ShouldWait()) { if (_prevMinion.IsValidTarget() && InAutoAttackRange(_prevMinion)) { var predHealth = HealthPrediction.LaneClearHealthPrediction( _prevMinion, (int)((Player.AttackDelay * 1000) * LaneClearWaitTimeMod), FarmDelay); if (predHealth >= 2 * GetAADamage(_prevMinion) || Math.Abs(predHealth - _prevMinion.Health) < float.Epsilon) { return(_prevMinion); } } result = (from minion in ObjectManager.Get <Obj_AI_Minion>() .Where(minion => minion.IsValidTarget() && InAutoAttackRange(minion) && minion.CharData.BaseSkinName != "gangplankbarrel") let predHealth = HealthPrediction.LaneClearHealthPrediction( minion, (int)((Player.AttackDelay * 1000) * LaneClearWaitTimeMod), FarmDelay) where predHealth >= 2 * GetAADamage(minion) || Math.Abs(predHealth - minion.Health) < float.Epsilon select minion).MaxOrDefault(m => m.Health); if (result != null) { _prevMinion = (Obj_AI_Minion)result; } } } return(result); }
public virtual AttackableUnit GetTarget() { AttackableUnit result = null; var mode = ActiveMode; if (ActiveMode == OrbwalkingMode.Flee || ActiveMode == OrbwalkingMode.WallJump) { return(null); } if ((mode == OrbwalkingMode.Mixed || mode == OrbwalkingMode.LaneClear) && !Menu.Item("PriorizeFarm").GetValue <bool>()) { var target = TargetSelector.GetTarget(-1, TargetSelector.DamageType.Physical); if (target != null && InAutoAttackRange(target)) { return(target); } } var attackGankPlankBarrels = Menu.Item("AttackGPBarrel").GetValue <StringList>().SelectedIndex; if (attackGankPlankBarrels != 2 && (attackGankPlankBarrels == 0 || mode == OrbwalkingMode.LaneClear || mode == OrbwalkingMode.Mixed || mode == OrbwalkingMode.LastHit || mode == OrbwalkingMode.Freeze)) { var enemyGangPlank = HeroManager.Enemies.FirstOrDefault( e => e.ChampionName.Equals("gangplank", StringComparison.InvariantCultureIgnoreCase)); if (enemyGangPlank != null) { var barrels = Get <Obj_AI_Minion>() .Where( minion => minion.Team == GameObjectTeam.Neutral && minion.CharData.BaseSkinName == "gangplankbarrel" && minion.IsHPBarRendered && minion.IsValidTarget() && InAutoAttackRange(minion)); var objAiMinions = barrels as Obj_AI_Minion[] ?? barrels.ToArray(); foreach (var barrel in objAiMinions) { if (barrel.Health <= 1f) { return(barrel); } var t = (int)(player.AttackCastDelay * 1000) + Game.Ping / 2 + 1000 * (int)Math.Max(0, player.Distance(barrel) - player.BoundingRadius) / (int)GetMyProjectileSpeed(); var barrelBuff = barrel.Buffs.FirstOrDefault( b => b.Name.Equals("gangplankebarrelactive", StringComparison.InvariantCultureIgnoreCase)); if (barrelBuff != null && barrel.Health <= 2f) { var healthDecayRate = enemyGangPlank.Level >= 13 ? 0.5f : (enemyGangPlank.Level >= 7 ? 1f : 2f); var nextHealthDecayTime = Game.Time < barrelBuff.StartTime + healthDecayRate ? barrelBuff.StartTime + healthDecayRate : barrelBuff.StartTime + healthDecayRate * 2; if (nextHealthDecayTime <= Game.Time + t / 1000f) { return(barrel); } } } if (objAiMinions.Any()) { return(null); } } } if (mode == OrbwalkingMode.LaneClear || mode == OrbwalkingMode.Mixed || mode == OrbwalkingMode.LastHit || mode == OrbwalkingMode.Freeze) { var MinionList = Get <Obj_AI_Minion>() .Where(minion => minion.IsValidTarget() && InAutoAttackRange(minion)) .OrderByDescending(minion => minion.CharData.BaseSkinName.Contains("Siege")) .ThenBy(minion => minion.CharData.BaseSkinName.Contains("Super")) .ThenBy(minion => minion.Health) .ThenByDescending(minion => minion.MaxHealth); foreach (var minion in MinionList) { var t = (int)(player.AttackCastDelay * 1000) - 100 + Game.Ping / 2 + 1000 * (int)Math.Max(0, player.Distance(minion) - player.BoundingRadius) / (int)GetMyProjectileSpeed(); if (mode == OrbwalkingMode.Freeze) { t += 200 + Game.Ping / 2; } var predHealth = HealthPrediction.GetHealthPrediction(minion, t, FarmDelay); if (minion.Team != GameObjectTeam.Neutral && ShouldAttackMinion(minion)) { var damage = player.GetAutoAttackDamage(minion, true); var killable = predHealth <= damage; if (mode == OrbwalkingMode.Freeze) { if (minion.Health < 50 || predHealth <= 50) { return(minion); } } else { if (predHealth <= 0) { FireOnNonKillableMinion(minion); } if (killable) { return(minion); } } } } } if (_forcedTarget.IsValidTarget() && InAutoAttackRange(_forcedTarget)) { return(_forcedTarget); } if (mode == OrbwalkingMode.LaneClear && (!Menu.Item("FocusMinionsOverTurrets").GetValue <KeyBind>().Active || !MinionManager.GetMinions(ObjectManager.Player.Position, GetRealAutoAttackRange(ObjectManager.Player)).Any())) { foreach (var turret in Get <Obj_AI_Turret>().Where(t => t.IsValidTarget() && InAutoAttackRange(t))) { return(turret); } foreach ( var turret in Get <Obj_BarracksDampener>().Where(t => t.IsValidTarget() && InAutoAttackRange(t))) { return(turret); } foreach (var nexus in Get <Obj_HQ>().Where(t => t.IsValidTarget() && InAutoAttackRange(t))) { return(nexus); } } if (mode != OrbwalkingMode.LastHit) { if (mode != OrbwalkingMode.LaneClear || !ShouldWait()) { var target = TargetSelector.GetTarget(-1, TargetSelector.DamageType.Physical); if (target.IsValidTarget() && InAutoAttackRange(target)) { return(target); } } } if (mode == OrbwalkingMode.LaneClear || mode == OrbwalkingMode.Mixed) { var jminions = Get <Obj_AI_Minion>() .Where( mob => mob.IsValidTarget() && mob.Team == GameObjectTeam.Neutral && InAutoAttackRange(mob) && mob.CharData.BaseSkinName != "gangplankbarrel" && mob.Name != "WardCorpse"); result = Menu.Item("Smallminionsprio").GetValue <bool>() ? jminions.MinOrDefault(mob => mob.MaxHealth) : jminions.MaxOrDefault(mob => mob.MaxHealth); if (result != null) { return(result); } } if (mode == OrbwalkingMode.LaneClear || mode == OrbwalkingMode.Mixed || mode == OrbwalkingMode.LastHit || mode == OrbwalkingMode.Freeze) { var closestTower = Get <Obj_AI_Turret>() .MinOrDefault(t => t.IsAlly && !t.IsDead ? player.Distance(t, true) : float.MaxValue); if (closestTower != null && player.Distance(closestTower, true) < 1500 * 1500) { Obj_AI_Minion farmUnderTurretMinion = null; Obj_AI_Minion noneKillableMinion = null; var minions = MinionManager.GetMinions(player.Position, player.AttackRange + 200) .Where(minion => InAutoAttackRange(minion) && closestTower.Distance(minion, true) < 900 * 900) .OrderByDescending(minion => minion.CharData.BaseSkinName.Contains("Siege")) .ThenBy(minion => minion.CharData.BaseSkinName.Contains("Super")) .ThenByDescending(minion => minion.MaxHealth) .ThenByDescending(minion => minion.Health); if (minions.Any()) { var turretMinion = minions.FirstOrDefault( minion => minion is Obj_AI_Minion && HealthPrediction.HasTurretAggro((Obj_AI_Minion)minion)); if (turretMinion != null) { var hpLeftBeforeDie = 0; var hpLeft = 0; var turretAttackCount = 0; var turretStarTick = HealthPrediction.TurretAggroStartTick(turretMinion as Obj_AI_Minion); var turretLandTick = turretStarTick + (int)(closestTower.AttackCastDelay * 1000) + 1000 * Math.Max(0, (int) (turretMinion.Distance(closestTower) - closestTower.BoundingRadius)) / (int)(closestTower.BasicAttack.MissileSpeed + 70); for (float i = turretLandTick + 50; i < turretLandTick + 10 * closestTower.AttackDelay * 1000 + 50; i = i + closestTower.AttackDelay * 1000) { var time = (int)i - Utils.GameTimeTickCount + Game.Ping / 2; var predHP = (int) HealthPrediction.LaneClearHealthPrediction(turretMinion, time > 0 ? time : 0); if (predHP > 0) { hpLeft = predHP; turretAttackCount += 1; continue; } hpLeftBeforeDie = hpLeft; hpLeft = 0; break; } if (hpLeft == 0 && turretAttackCount != 0 && hpLeftBeforeDie != 0) { var damage = (int)player.GetAutoAttackDamage(turretMinion, true); var hits = hpLeftBeforeDie / damage; var timeBeforeDie = turretLandTick + (turretAttackCount + 1) * (int)(closestTower.AttackDelay * 1000) - Utils.GameTimeTickCount; var timeUntilAttackReady = LastAATick + (int)(player.AttackDelay * 1000) > Utils.GameTimeTickCount + Game.Ping / 2 + 25 ? LastAATick + (int)(player.AttackDelay * 1000) - (Utils.GameTimeTickCount + Game.Ping / 2 + 25) : 0; var timeToLandAttack = player.IsMelee ? player.AttackCastDelay * 1000 : player.AttackCastDelay * 1000 + 1000 * Math.Max(0, turretMinion.Distance(player) - player.BoundingRadius) / player.BasicAttack.MissileSpeed; if (hits >= 1 && hits * player.AttackDelay * 1000 + timeUntilAttackReady + timeToLandAttack < timeBeforeDie) { farmUnderTurretMinion = turretMinion as Obj_AI_Minion; } else if (hits >= 1 && hits * player.AttackDelay * 1000 + timeUntilAttackReady + timeToLandAttack > timeBeforeDie) { noneKillableMinion = turretMinion as Obj_AI_Minion; } } else if (hpLeft == 0 && turretAttackCount == 0 && hpLeftBeforeDie == 0) { noneKillableMinion = turretMinion as Obj_AI_Minion; } if (ShouldWaitUnderTurret(noneKillableMinion)) { return(null); } if (farmUnderTurretMinion != null) { return(farmUnderTurretMinion); } foreach ( var minion in minions.Where( x => x.NetworkId != turretMinion.NetworkId && x is Obj_AI_Minion && !HealthPrediction.HasMinionAggro((Obj_AI_Minion)x))) { var playerDamage = (int)player.GetAutoAttackDamage(minion); var turretDamage = (int)closestTower.GetAutoAttackDamage(minion, true); var leftHP = (int)minion.Health % turretDamage; if (leftHP > playerDamage) { return(minion); } } var lastminion = minions.LastOrDefault( x => x.NetworkId != turretMinion.NetworkId && x is Obj_AI_Minion && !HealthPrediction.HasMinionAggro((Obj_AI_Minion)x)); if (lastminion != null && minions.Count() >= 2) { if (1f / player.AttackDelay >= 1f && (int)(turretAttackCount * closestTower.AttackDelay / player.AttackDelay) * player.GetAutoAttackDamage(lastminion) > lastminion.Health) { return(lastminion); } if (minions.Count() >= 5 && 1f / player.AttackDelay >= 1.2) { return(lastminion); } } } else { if (ShouldWaitUnderTurret(noneKillableMinion)) { return(null); } foreach ( var minion in minions.Where( x => x is Obj_AI_Minion && !HealthPrediction.HasMinionAggro((Obj_AI_Minion)x))) { { var playerDamage = (int)player.GetAutoAttackDamage(minion); var turretDamage = (int)closestTower.GetAutoAttackDamage(minion, true); var leftHP = (int)minion.Health % turretDamage; if (leftHP > playerDamage) { return(minion); } } } var lastminion = minions.LastOrDefault( x => x is Obj_AI_Minion && !HealthPrediction.HasMinionAggro((Obj_AI_Minion)x)); if (lastminion == null || minions.Count() < 2) { return(null); } if (minions.Count() >= 5 && 1f / player.AttackDelay >= 1.2) { return(lastminion); } } return(null); } } } if (mode == OrbwalkingMode.LaneClear) { if (!ShouldWait()) { if (_prevMinion.IsValidTarget() && InAutoAttackRange(_prevMinion)) { var predHealth = HealthPrediction.LaneClearHealthPrediction(_prevMinion, (int)(player.AttackDelay * 1000 * LaneClearWaitTimeMod), FarmDelay); if (predHealth >= 2 * player.GetAutoAttackDamage(_prevMinion) || Math.Abs(predHealth - _prevMinion.Health) < float.Epsilon) { return(_prevMinion); } } result = Get <Obj_AI_Minion>() .Where( minion => minion.IsValidTarget() && InAutoAttackRange(minion) && ShouldAttackMinion(minion)) .Select( minion => new { minion, predHealth = HealthPrediction.LaneClearHealthPrediction(minion, (int)(player.AttackDelay * 1000 * LaneClearWaitTimeMod), FarmDelay) }) .Where( t => t.predHealth >= 2 * player.GetAutoAttackDamage(t.minion) || Math.Abs(t.predHealth - t.minion.Health) < float.Epsilon) .Select(t => t.minion) .MaxOrDefault(m => !MinionManager.IsMinion(m, true) ? float.MaxValue : m.Health); if (result != null) { _prevMinion = (Obj_AI_Minion)result; } } } return(result); }