public static void CastBasicSkillShot(Spell spell, float range, TargetSelector.DamageType type, HitChance hitChance, bool towerCheck = false) { var target = TargetSelector.GetTarget(range, type); if (target == null || !spell.IsReady()) return; if (towerCheck && target.UnderTurret(true)) return; spell.UpdateSourcePosition(); if (spell.Type == SkillshotType.SkillshotCircle) { var pred = Prediction.GetPrediction(target, spell.Delay); if (pred.Hitchance >= hitChance) spell.Cast(pred.CastPosition); } else { spell.CastIfHitchanceEquals(target, hitChance); } }
public static MenuItem AddHitChance(this Menu menu, string name, string displayName, HitChance defaultHitChance) { return menu.AddItem( new MenuItem(name, displayName).SetValue( new StringList(new[] { "Low", "Medium", "High", "Very High" }, (int) defaultHitChance - 3))); }
public void CastSkillshot(Obj_AI_Hero t, Spell s, HitChance hc = HitChance.High) { if (!s.IsSkillshot) return; PredictionOutput p = s.GetPrediction(t); if (s.Collision) { for (int i = 0; i < p.CollisionObjects.Count; i++) if (!p.CollisionObjects[i].IsDead && (p.CollisionObjects[i].IsEnemy || p.CollisionObjects[i].IsMinion)) return; } if ((t.HasBuffOfType(BuffType.Slow) && p.Hitchance >= HitChance.High) || p.Hitchance == HitChance.Immobile) s.Cast(p.CastPosition); else if (t.IsRecalling()) s.Cast(t.ServerPosition); else { if (s.IsReady()) { s.SPredictionCast(t, hc); } } }
public override void Cast(Obj_AI_Hero target, bool force = false, HitChance minChance = HitChance.Low) { if (HasBeenSafeCast() || target == null || target.GetWaypoints().Last().Distance(target) > 50) return; var prediction = Spell.GetPrediction(target, true); if (prediction.Hitchance < minChance) return; SafeCast(() => Spell.Cast(prediction.CastPosition)); }
public void CastSkillshot(string spell, Obj_AI_Base target, HitChance hitChance = HitChance.VeryHigh, bool packet = true, bool aoe = false) { if (!Spells[spell].IsReady()) return; if (target.IsValidTarget(Spells[spell].Range) && Spells[spell].GetPrediction(target).Hitchance >= hitChance) Spells[spell].Cast(target, packet, aoe); }
public static void CastBasicSkillShot(Spell spell, float range, LeagueSharp.Common.TargetSelector.DamageType type, HitChance hitChance) { var target = LeagueSharp.Common.TargetSelector.GetTarget(range, type); if (target == null || !spell.IsReady()) return; spell.UpdateSourcePosition(); if (spell.GetPrediction(target).Hitchance >= hitChance) spell.Cast(target, packets()); }
public static void CastSpell(Spell spell, Obj_AI_Base target, HitChance hitChance, bool packetCast) { Obj_AI_Hero Player = ObjectManager.Player; if (target.IsValidTarget(spell.Range) && spell.GetPrediction(target).Hitchance >= hitChance) { spell.Cast(target, packetCast); LastCastTime = Environment.TickCount; Orbwalking.ResetAutoAttackTimer(); } }
public static bool HitChanceCast(this Spell.Skillshot spell, Obj_AI_Base target, HitChance chance) { var pred = spell.GetPrediction(target); if (pred.HitChance >= chance) if (spell.Cast(pred.CastPosition)) return true; return false; }
/// <summary> /// Initializes a new instance of the <see cref="Spell" /> class. /// </summary> /// <param name="spellDataWrapper"> /// SpellSlot Wrapper /// </param> /// <param name="hitChance"> /// Minimum Hit Chance /// </param> public Spell(SpellDataWrapper spellDataWrapper, HitChance hitChance = HitChance.Medium) { this.Slot = spellDataWrapper.Slot; this.Range = spellDataWrapper.Range; this.Width = spellDataWrapper.Width; this.Speed = spellDataWrapper.Speed; this.Delay = spellDataWrapper.Delay; this.MinHitChance = hitChance; }
public void CastSkillshot(string spell, SimpleTs.DamageType damageType, HitChance hitChance = HitChance.VeryHigh, bool packet = true, bool aoe = false) { if (!Spells[spell].IsReady()) return; Obj_AI_Hero target = SimpleTs.GetTarget(Spells[spell].Range, damageType); if (target == null) return; if (target.IsValidTarget(Spells[spell].Range) && Spells[spell].GetPrediction(target).Hitchance >= hitChance) Spells[spell].Cast(target, packet, aoe); }
public static void PierceCombo(int collisionObject, HitChance hChance) { foreach (var enemy in HeroManager.Enemies.Where(hero => hero.IsValidTarget(Program.Q.Range) && hero.IsVisible && !hero.IsDead && !hero.IsZombie)) { if (Program.Q.GetPrediction(enemy).Hitchance >= hChance && Program.Q.GetPrediction(enemy).CollisionObjects.Count == 0) { Program.Q.Cast(enemy); } } }
public static void Cast(this Spell.Chargeable spell, Obj_AI_Base target, HitChance hitChance) { if (target != null && spell.IsReady() && target.IsKillable(spell.MaximumRange)) { var pred = spell.GetPrediction(target); if (pred.HitChance >= hitChance || target.IsCC()) { spell.Cast(pred.CastPosition); } } }
public SnipePrediction(Events.InvisibleEventArgs targetArgs) { SnipeChance = HitChance.Impossible; target = targetArgs.sender; invisibleStartTime = targetArgs.StartTime; lastRealPath = targetArgs.LastRealPath; ultBoundingRadius = Listing.UltSpellDataList[ObjectManager.Player.ChampionName].Width; Teleport.OnTeleport += SnipePredictionOnTeleport; }
public static void Cast(this Spell.Skillshot spell, Obj_AI_Base target, HitChance hitChance, bool value = true) { if (target != null && spell.IsReady() && target.IsKillable(spell.Range)) { var pred = spell.GetPrediction(target); if (pred.HitChance >= hitChance || value) { spell.Cast(pred.CastPosition); } } }
public static void Cast(this Spell.SpellBase spell, Obj_AI_Base target, HitChance hitChance) { var thisspell = spell as Spell.Skillshot; if (target != null && spell.IsReady() && target.IsKillable(spell.Range)) { var pred = thisspell.GetPrediction(target); if (pred.HitChance >= hitChance || target.IsCC()) { spell.Cast(pred.CastPosition); } } }
public override void Cast(Obj_AI_Hero target, bool force = false, HitChance minChance = HitChance.Low) { if (target == null) return; if (ObjectManager.Player.HasBuff("ekkoattackbuff") && target.Distance(ObjectManager.Player) < 500) { ObjectManager.Player.IssueOrder(GameObjectOrder.AutoAttack, target); } if (HasBeenSafeCast() || target.Distance(ObjectManager.Player) < ObjectManager.Player.AttackRange + ObjectManager.Player.BoundingRadius + target.BoundingRadius) return; SafeCast(() => Spell.Cast(target.Position)); }
public static void PierceJungleClear(Spell spell, HitChance hChance) { var mob = MinionManager.GetMinions(ObjectManager.Player.ServerPosition, Orbwalking.GetRealAutoAttackRange(ObjectManager.Player) + 100, MinionTypes.All, MinionTeam.Neutral, MinionOrderTypes.MaxHealth); if (mob == null || mob.Count == 0) { return; } if (Program.Q.GetPrediction(mob[0]).Hitchance >= hChance && Program.Q.GetPrediction(mob[0]).CollisionObjects.Count == 0) { Program.Q.Cast(mob[0]); } }
public void RegisterSpellUsage( Spell.SpellBase spell, Orbwalker.ActiveModes modes, DamageType damageType = DamageType.Physical, Func<bool> preCondition = null, Func<AIHeroClient, bool> heroCondition = null, Func<Obj_AI_Minion, bool> minionCondition = null, HitChance hitChance = HitChance.Unknown, bool checkTarget = true, string customName = null) { GetModes(modes).ForEach(mode => { SpellUsages[mode].Add(new SpellUsage(customName, spell, damageType, preCondition, heroCondition, minionCondition, hitChance, checkTarget)); }); }
public static Slider CreateHCSlider(string identifier, string displayName, HitChance defaultValue, Menu menu) { var slider = menu.Add(identifier, new Slider(displayName, (int)defaultValue, 0, 8)); var hcNames = new[] {"Unknown", "Impossible", "Collision", "Low", "AveragePoint", "Medium", "High", "Dashing", "Immobile"}; slider.DisplayName = hcNames[slider.CurrentValue]; slider.OnValueChange += delegate (ValueBase<int> sender, ValueBase<int>.ValueChangeArgs changeArgs) { sender.DisplayName = hcNames[changeArgs.NewValue]; }; return slider; }
public void CancelProcess() { try { lastEstimatedPosition = new Vector3(0,0,0); SnipeChance = HitChance.Impossible; Teleport.OnTeleport -= SnipePredictionOnTeleport; Drawing.OnDraw -= OnDraw; Game.OnUpdate -= MoveCamera; } catch { // ignored } }
public override void Cast(Obj_AI_Hero target, bool force = false, HitChance minChance = HitChance.Low) { if (HasBeenSafeCast()) return; var ekko = ObjectManager.Get<GameObject>().FirstOrDefault(item => item.Name == "Ekko_Base_R_TrailEnd.troy"); if (ekko == null) return; var enemyCount = HeroManager.Enemies.Count(enemy => enemy.Distance(ekko.Position) < 400 && enemy.IsValidTarget()); if (enemyCount >= _ultMin.GetValue<Slider>().Value && ObjectManager.Player.HealthPercent >= _ultMinHealth.GetValue<Slider>().Value) { SafeCast(() => Spell.Cast()); } if (_ultSave.GetValue<bool>() && (HealthPrediction.GetHealthPrediction(ObjectManager.Player, 1) < 0 && enemyCount == 0 || ObjectManager.Player.HealthPercent < 10 && (target == null || target.HealthPercent > 20))) { SafeCast(() => Spell.Cast()); } }
public static void DrawPrediction(string name, Vector3 position, HitChance hitchance) { try { var pos = Drawing.WorldToScreen(position); var color = Menu.Item(hitchance.ToString()).GetValue<Circle>().Color; Drawing.DrawText(pos.X, pos.Y, color, name); Render.Circle.DrawCircle(position, CircleRadius, color); } catch { Console.WriteLine("NULL"); } //Drawing.DrawCircle(position, 800, color); }
public static bool DoCast(Spell spell, Obj_AI_Hero target, HitChance minHitChance, bool colisionCheck=false) { // Data.Static.Objects.ProjectLogger.WriteLog("DoCast Call"); if ((PredictionMethod==0)||((PredictionMethod==1)&&colisionCheck)) //Sebby Colision is broken...lol { var output=spell.GetPrediction(target); if (colisionCheck) if (CheckColision(output)) return false; if (minHitChance>output.Hitchance) return false; spell.Cast(output.CastPosition); return true; } if (PredictionMethod==1) { var output=SebbyLib.Prediction.Prediction.GetPrediction(target, spell.Delay); if (minHitChance>(HitChance)output.Hitchance) return false; spell.Cast(output.CastPosition); return true; } if (PredictionMethod==2) { var output=spell.GetSPrediction(target); if (colisionCheck) if (CheckColision(output)) return false; if (minHitChance>output.HitChance) return false; spell.Cast(output.CastPosition); return true; } return false; }
/// <summary> /// Initializes a new instance of the <see cref="Spell" /> class. /// </summary> /// <param name="slot"> /// The SpellSlot /// </param> /// <param name="loadFromGame"> /// Load SpellData From Game /// </param> /// <param name="hitChance"> /// Minimum Hit Chance /// </param> public Spell(SpellSlot slot, bool loadFromGame, HitChance hitChance = HitChance.Medium) { this.Slot = slot; if (!loadFromGame) { return; } var spellData = GameObjects.Player.Spellbook.GetSpell(slot).SData; this.Range = spellData.CastRange; this.Width = spellData.LineWidth.Equals(0) ? spellData.CastRadius : spellData.LineWidth; this.Speed = spellData.MissileSpeed; this.Delay = spellData.DelayTotalTimePercent; this.MinHitChance = hitChance; }
private static void CastE(Obj_AI_Base t, HitChance hitchance) { if (Player.ServerPosition.Distance(t.ServerPosition) < ECastRange) { E.UpdateSourcePosition(t.ServerPosition, t.ServerPosition); var pred = E.GetPrediction(t, true); if (pred.Hitchance >= hitchance) E.Cast(t.ServerPosition, pred.CastPosition); } else if (Player.ServerPosition.Distance(t.ServerPosition) < ECastRange + E.Range) { var castStartPos = Player.ServerPosition.Extend(t.ServerPosition, ECastRange); E.UpdateSourcePosition(castStartPos, castStartPos); var pred = E.GetPrediction(t, true); if (pred.Hitchance >= hitchance) E.Cast(castStartPos, pred.CastPosition); } }
public static void HitChances() { switch (menu.Misc["hitChance"].Cast<ComboBox>().CurrentValue) { case 0: { hitchance = HitChance.High; } break; case 1: { hitchance = HitChance.Medium; } break; case 2: { hitchance = HitChance.Low; } break; } }
public static void SkillShot(Obj_AI_Hero target, Spell spell, HitChance hitChance, bool boundingRadius = true, bool maxRange = true) { if (!spell.IsReady() || target == null) { return; } if (spell.Type == SkillshotType.SkillshotLine) { var prediction = CPrediction.Line(spell, target, hitChance, boundingRadius, maxRange); if (prediction.TotalHits >= 1) { spell.Cast(prediction.CastPosition); } } else if (spell.Type == SkillshotType.SkillshotCircle) { var prediction = CPrediction.Circle(spell, target, hitChance); if (prediction.TotalHits >= 1) { spell.Cast(prediction.CastPosition); } } else { var prediction = spell.GetPrediction(target); if (prediction.Hitchance >= hitChance) { spell.Cast(prediction.CastPosition); } } }
public static void SkillShot(Obj_AI_Base target, Spell spell, HitChance hitChance, bool aoe = false, bool towerCheck = false) { if (!spell.IsReady()) { return; } if (target == null || towerCheck && target.UnderTurret(true)) { return; } spell.UpdateSourcePosition(); var prediction = spell.GetPrediction(target, aoe); if (prediction.Hitchance >= hitChance) { spell.Cast(prediction.CastPosition); } }
/// <summary> /// Spell extension for cast vector spell with SPrediction /// </summary> /// <param name="s">Spell to cast</param> /// <param name="t">Target for spell</param> /// <param name="ringRadius">Ring Radius</param> /// <param name="hc">Minimum HitChance to cast</param> /// <param name="reactionIgnoreDelay">Delay to ignore target's reaction time</param> /// <param name="minHit">Minimum Hit Count to cast</param> /// <param name="rangeCheckFrom">Position where spell will be casted from</param> /// <param name="filterHPPercent">Minimum HP Percent to cast (for target)</param> /// <returns>true if spell has casted</returns> public static bool SPredictionCastRing(this Spell s, Obj_AI_Hero t, float ringRadius, HitChance hc, bool onlyEdge = true, int reactionIgnoreDelay = 0, byte minHit = 1, Vector3?rangeCheckFrom = null, float filterHPPercent = 100) { if (Prediction.predMenu != null && Prediction.predMenu.Item("PREDICTONLIST").GetValue <StringList>().SelectedIndex == 1) { throw new NotSupportedException("Vector Prediction not supported in Common prediction"); } if (minHit > 1) { throw new NotSupportedException("Ring aoe prediction not supported yet"); } if (t.HealthPercent > filterHPPercent) { return(false); } if (rangeCheckFrom == null) { rangeCheckFrom = ObjectManager.Player.ServerPosition; } if (Monitor.TryEnter(PathTracker.EnemyInfo[t.NetworkId].m_lock)) { try { float avgt = t.AvgMovChangeTime() + reactionIgnoreDelay; float movt = t.LastMovChangeTime(); float avgp = t.AvgPathLenght(); Prediction.Result result; if (onlyEdge) { result = RingPrediction.GetPrediction(t, s.Width, ringRadius, s.Delay, s.Speed, s.Range, s.Collision, t.GetWaypoints(), avgt, movt, avgp, s.From.To2D(), rangeCheckFrom.Value.To2D()); } else { result = CirclePrediction.GetPrediction(t, s.Width, s.Delay, s.Speed, s.Range + ringRadius, s.Collision, t.GetWaypoints(), avgt, movt, avgp, 360, s.From.To2D(), rangeCheckFrom.Value.To2D()); } Prediction.lastDrawTick = Utils.TickCount; Prediction.lastDrawPos = result.CastPosition; Prediction.lastDrawHitchance = result.HitChance.ToString(); Prediction.lastDrawDirection = (result.CastPosition - s.From.To2D()).Normalized().Perpendicular(); Prediction.lastDrawWidth = (int)ringRadius; if (result.HitChance >= hc) { s.Cast(result.CastPosition); return(true); } Monitor.Pulse(PathTracker.EnemyInfo[t.NetworkId].m_lock); return(false); } finally { Monitor.Exit(PathTracker.EnemyInfo[t.NetworkId].m_lock); } } return(false); }
/// <summary> /// Cast Spell if HitChance equals to input HitChance /// </summary> /// <param name="unit">The Target</param> /// <param name="hitChance">The HitChance</param> /// <returns>Was Spell Casted</returns> public CastStates CastIfHitchanceEquals(Obj_AI_Base unit, HitChance hitChance) { return(this.Cast(unit, true, false, -1, hitChance)); }
public static void E(Obj_AI_Base enemy, HitChance hit) { Cast.E(enemy, hit, SpellSlot.R); }
public override bool UseAbility(Unit9 target, HitChance minimumChance, bool queue = false, bool bypass = false) { return(this.UseAbility(target, queue, bypass)); }
public static Vector3 PredCastPos(this Spell s, AIHeroClient t, HitChance hc, int reactionIgnoreDelay = 0, byte minHit = 1, Vector3?rangeCheckFrom = null, float filterHPPercent = 100) { if (rangeCheckFrom == null) { rangeCheckFrom = ObjectManager.Player.PreviousPosition; } if (t == null) { return(Vector3.Zero); } /*if (!s.IsSkillShot) * return Vector3.Zero;*/ #region if common prediction selected if (ConfigMenu.SelectedPrediction.Index == 1) { var pout = s.GetPrediction(t, minHit > 1); if (minHit > 1) { if (pout.AoeTargetsHitCount >= minHit) { return(pout.CastPosition); } } if (pout.Hitchance >= hc) { return(pout.CastPosition); } } #endregion #region if fs prediction selected if (ConfigMenu.SelectedPrediction.Index == 2) { var pout = FSpred.Prediction.Prediction.GetPrediction(s, t, minHit > 1); if (minHit > 1) { if (pout.AoeTargetsHitCount >= minHit) { return(pout.CastPosition); } } if ((int)pout.Hitchance >= (int)hc) { return(pout.CastPosition); } } #endregion #region If Exory Prediction Selected if (ConfigMenu.SelectedPrediction.Index == 3) { var pout = SebbyLibPorted.Prediction.Prediction.GetPrediction(s, t, minHit > 1); if (minHit > 1) { if (pout.AoeTargetsHitCount >= minHit) { return(pout.CastPosition); } } if ((int)pout.Hitchance >= (int)hc) { return(pout.CastPosition); } } #endregion /*if (minHit > 1) * return SPredictionCastAoe(s, minHit);*/ if (t.HealthPercent > filterHPPercent) { return(Vector3.Zero); } float avgt = t.AvgMovChangeTime() + reactionIgnoreDelay; float movt = t.LastMovChangeTime(); float avgp = t.AvgPathLenght(); var waypoints = t.GetWaypoints(); Prediction.Result result; switch (s.Type) { case SpellType.Line: result = LinePrediction.GetPrediction(t, s.Width, s.Delay, s.Speed, s.Range, s.Collision, waypoints, avgt, movt, avgp, t.LastAngleDiff(), s.From.ToVector2(), s.RangeCheckFrom.ToVector2()); break; case SpellType.Circle: result = CirclePrediction.GetPrediction(t, s.Width, s.Delay, s.Speed, s.Range, s.Collision, waypoints, avgt, movt, avgp, t.LastAngleDiff(), s.From.ToVector2(), s.RangeCheckFrom.ToVector2()); break; case SpellType.Cone: result = ConePrediction.GetPrediction(t, s.Width, s.Delay, s.Speed, s.Range, s.Collision, waypoints, avgt, movt, avgp, t.LastAngleDiff(), s.From.ToVector2(), s.RangeCheckFrom.ToVector2()); break; default: throw new InvalidOperationException("Unknown spell type"); } Drawings.s_DrawTick = Variables.TickCount; Drawings.s_DrawPos = result.CastPosition; Drawings.s_DrawHitChance = result.HitChance.ToString(); Drawings.s_DrawDirection = (result.CastPosition - s.From.ToVector2()).Normalized().Perpendicular(); Drawings.s_DrawWidth = (int)s.Width; if (result.HitChance >= hc) { return(result.CastPosition.ToVector3()); } return(Vector3.Zero); }
public static void CastSpell(Spell QWER, Obj_AI_Base target) { int predIndex = 0; HitChance hitchance = HitChance.Low; if (QWER.Slot == SpellSlot.Q) { predIndex = Config.Item("Qpred", true).GetValue <StringList>().SelectedIndex; if (Config.Item("QHitChance", true).GetValue <StringList>().SelectedIndex == 0) { hitchance = HitChance.VeryHigh; } else if (Config.Item("QHitChance", true).GetValue <StringList>().SelectedIndex == 1) { hitchance = HitChance.High; } else if (Config.Item("QHitChance", true).GetValue <StringList>().SelectedIndex == 2) { hitchance = HitChance.Medium; } } else if (QWER.Slot == SpellSlot.W) { predIndex = Config.Item("Wpred", true).GetValue <StringList>().SelectedIndex; if (Config.Item("WHitChance", true).GetValue <StringList>().SelectedIndex == 0) { hitchance = HitChance.VeryHigh; } else if (Config.Item("WHitChance", true).GetValue <StringList>().SelectedIndex == 1) { hitchance = HitChance.High; } else if (Config.Item("WHitChance", true).GetValue <StringList>().SelectedIndex == 2) { hitchance = HitChance.Medium; } } else if (QWER.Slot == SpellSlot.E) { predIndex = Config.Item("Epred", true).GetValue <StringList>().SelectedIndex; if (Config.Item("EHitChance", true).GetValue <StringList>().SelectedIndex == 0) { hitchance = HitChance.VeryHigh; } else if (Config.Item("EHitChance", true).GetValue <StringList>().SelectedIndex == 1) { hitchance = HitChance.High; } else if (Config.Item("EHitChance", true).GetValue <StringList>().SelectedIndex == 2) { hitchance = HitChance.Medium; } } else if (QWER.Slot == SpellSlot.R) { predIndex = Config.Item("Rpred", true).GetValue <StringList>().SelectedIndex; if (Config.Item("RHitChance", true).GetValue <StringList>().SelectedIndex == 0) { hitchance = HitChance.VeryHigh; } else if (Config.Item("RHitChance", true).GetValue <StringList>().SelectedIndex == 1) { hitchance = HitChance.High; } else if (Config.Item("RHitChance", true).GetValue <StringList>().SelectedIndex == 2) { hitchance = HitChance.Medium; } } if (predIndex == 4) { if (QWER.Type == SkillshotType.SkillshotCircle) { Core.PredictionAio.CCast(QWER, target, hitchance); } else if (QWER.Type == SkillshotType.SkillshotLine) { Core.PredictionAio.LCast(QWER, target, hitchance); } else { QWER.Cast(target); } } if (predIndex == 3) { SebbyLib.Movement.SkillshotType CoreType2 = SebbyLib.Movement.SkillshotType.SkillshotLine; bool aoe2 = false; if (QWER.Type == SkillshotType.SkillshotCircle) { //CoreType2 = SebbyLib.Movement.SkillshotType.SkillshotCircle; //aoe2 = true; } if (QWER.Width > 80 && !QWER.Collision) { aoe2 = true; } var predInput2 = new SebbyLib.Movement.PredictionInput { Aoe = aoe2, Collision = QWER.Collision, Speed = QWER.Speed, Delay = QWER.Delay, Range = QWER.Range, From = Player.ServerPosition, Radius = QWER.Width, Unit = target, Type = CoreType2 }; var poutput2 = SebbyLib.Movement.Prediction.GetPrediction(predInput2); //var poutput2 = QWER.GetPrediction(target); if (QWER.Speed != float.MaxValue && OktwCommon.CollisionYasuo(Player.ServerPosition, poutput2.CastPosition)) { return; } if ((int)hitchance == 6) { if (poutput2.Hitchance >= SebbyLib.Movement.HitChance.VeryHigh) { QWER.Cast(poutput2.CastPosition); } else if (predInput2.Aoe && poutput2.AoeTargetsHitCount > 1 && poutput2.Hitchance >= SebbyLib.Movement.HitChance.High) { QWER.Cast(poutput2.CastPosition); } } else if ((int)hitchance == 5) { if (poutput2.Hitchance >= SebbyLib.Movement.HitChance.High) { QWER.Cast(poutput2.CastPosition); } } else if ((int)hitchance == 4) { if (poutput2.Hitchance >= SebbyLib.Movement.HitChance.Medium) { QWER.Cast(poutput2.CastPosition); } } } else if (predIndex == 1) { SebbyLib.Prediction.SkillshotType CoreType2 = SebbyLib.Prediction.SkillshotType.SkillshotLine; bool aoe2 = false; if (QWER.Type == SkillshotType.SkillshotCircle) { CoreType2 = SebbyLib.Prediction.SkillshotType.SkillshotCircle; aoe2 = true; } if (QWER.Width > 80 && !QWER.Collision) { aoe2 = true; } var predInput2 = new SebbyLib.Prediction.PredictionInput { Aoe = aoe2, Collision = QWER.Collision, Speed = QWER.Speed, Delay = QWER.Delay, Range = QWER.Range, From = Player.ServerPosition, Radius = QWER.Width, Unit = target, Type = CoreType2 }; var poutput2 = SebbyLib.Prediction.Prediction.GetPrediction(predInput2); //var poutput2 = QWER.GetPrediction(target); if (QWER.Speed != float.MaxValue && OktwCommon.CollisionYasuo(Player.ServerPosition, poutput2.CastPosition)) { return; } if ((int)hitchance == 6) { if (poutput2.Hitchance >= SebbyLib.Prediction.HitChance.VeryHigh) { QWER.Cast(poutput2.CastPosition); } else if (predInput2.Aoe && poutput2.AoeTargetsHitCount > 1 && poutput2.Hitchance >= SebbyLib.Prediction.HitChance.High) { QWER.Cast(poutput2.CastPosition); } } else if ((int)hitchance == 5) { if (poutput2.Hitchance >= SebbyLib.Prediction.HitChance.High) { QWER.Cast(poutput2.CastPosition); } } else if ((int)hitchance == 4) { if (poutput2.Hitchance >= SebbyLib.Prediction.HitChance.Medium) { QWER.Cast(poutput2.CastPosition); } } if (Game.Time - DrawSpellTime > 0.5) { DrawSpell = QWER; DrawSpellTime = Game.Time; } DrawSpellPos = poutput2; } else if (predIndex == 0) { QWER.CastIfHitchanceEquals(target, hitchance); } else if (predIndex == 2) { if (target is Obj_AI_Hero && target.IsValid) { var t = target as Obj_AI_Hero; QWER.SPredictionCast(t, hitchance); } else { QWER.CastIfHitchanceEquals(target, HitChance.High); } } }
private static void harassChance_ValueChanged(object sender, OnValueChangeEventArgs e) { HarassHitChance = (HitChance)(e.GetNewValue <StringList>().SelectedIndex + 4); }
/// <summary> /// Note: if you already got the hitchance enum, just set the MinComboHitchance field! /// </summary> /// <param name="hitchance"></param> public void SetMinComboHitchance(string hitchance) { MinComboHitchance = hitchance.ToEnum <HitChance>(); }
public Result(Input inp, AIBaseClient unit, Vector2 castpos, Vector2 unitpos, HitChance hc, Collision.Result col) { Input = inp; Unit = unit; CastPosition = castpos; UnitPosition = unitpos; HitChance = hc; CollisionResult = col; }
public static void SkillShot(Spell spell, HitChance hitChance, bool boundingRadius = true, bool maxRange = true) { SkillShot(TargetSelector.GetTarget(spell), spell, hitChance); }
private void SnipePredictionOnTeleport(Obj_AI_Base sender, Teleport.TeleportEventArgs args) { if (sender != target) { return; } float timeElapsed_ms = Core.GameTickCount - invisibleStartTime; if (DoesCollide().Any()) { SnipeChance = HitChance.Collision; } if (args.Status == TeleportStatus.Start) { float maxWalkDist = target.Position.Distance(lastRealPath.Last()); float moveSpeed = target.MoveSpeed; float normalTime_ms = maxWalkDist / moveSpeed * 1000; /*target hasn't reached end point*/ if (timeElapsed_ms <= normalTime_ms) { SnipeChance = HitChance.High; } else if (timeElapsed_ms > normalTime_ms) /*target reached endPoint and is nearby*/ { float extraTimeElapsed = timeElapsed_ms - normalTime_ms; float targetSafeZoneTime = ultBoundingRadius / moveSpeed * 1000; if (extraTimeElapsed < targetSafeZoneTime) { /*target has reached end point but is still in danger zone*/ SnipeChance = HitChance.Medium; } else { /*target too far away*/ SnipeChance = HitChance.Low; } } float realDist = moveSpeed * (timeElapsed_ms / 1000); CastPosition = GetCastPosition(realDist); lastEstimatedPosition = CastPosition; } if (args.Status == TeleportStatus.Abort) { SnipeChance = HitChance.Impossible; CancelProcess(); } int minHitChance = Listing.snipeMenu.Get <Slider>("minSnipeHitChance").CurrentValue; int currentHitChanceInt = 0; if ((int)SnipeChance <= 2) { currentHitChanceInt = 0; } else if (SnipeChance == HitChance.Low) { currentHitChanceInt = 1; } else if (SnipeChance == HitChance.Medium) { currentHitChanceInt = 2; } else if (SnipeChance == HitChance.High) { currentHitChanceInt = 3; } if (currentHitChanceInt >= minHitChance) { if (Listing.snipeMenu.Get <CheckBox>("snipeDraw").CurrentValue) { Drawing.OnDraw += OnDraw; } CheckUltCast(args.Start + args.Duration); } else { CancelProcess(); } }
/// <summary> /// Spell extension for cast vector spell with SPrediction /// </summary> /// <param name="s">Spell to cast</param> /// <param name="t">Target for spell</param> /// <param name="ringRadius">Ring Radius</param> /// <param name="hc">Minimum HitChance to cast</param> /// <param name="reactionIgnoreDelay">Delay to ignore target's reaction time</param> /// <param name="minHit">Minimum Hit Count to cast</param> /// <param name="rangeCheckFrom">Position where spell will be casted from</param> /// <param name="filterHPPercent">Minimum HP Percent to cast (for target)</param> /// <returns>true if spell has casted</returns> public static bool SPredictionCastRing(this Spell s, AIHeroClient t, float ringRadius, HitChance hc, bool onlyEdge = true, int reactionIgnoreDelay = 0, byte minHit = 1, Vector3?rangeCheckFrom = null, float filterHPPercent = 100) { if (ConfigMenu.SelectedPrediction.SelectedIndex == 1) { throw new NotSupportedException("Vector Prediction not supported in Common prediction"); } if (minHit > 1) { throw new NotSupportedException("Ring aoe prediction not supported yet"); } if (t.HealthPercent > filterHPPercent) { return(false); } if (rangeCheckFrom == null) { rangeCheckFrom = ObjectManager.Player.ServerPosition; } float avgt = t.AvgMovChangeTime() + reactionIgnoreDelay; float movt = t.LastMovChangeTime(); float avgp = t.AvgPathLenght(); Prediction.Result result; if (onlyEdge) { result = RingPrediction.GetPrediction(t, s.Width, ringRadius, s.Delay, s.Speed, s.Range, s.Collision, t.GetWaypoints(), avgt, movt, avgp, s.From.To2D(), rangeCheckFrom.Value.To2D()); } else { result = CirclePrediction.GetPrediction(t, s.Width, s.Delay, s.Speed, s.Range + ringRadius, s.Collision, t.GetWaypoints(), avgt, movt, avgp, 360, s.From.To2D(), rangeCheckFrom.Value.To2D()); } Drawings.s_DrawTick = Utils.TickCount; Drawings.s_DrawPos = result.CastPosition; Drawings.s_DrawHitChance = result.HitChance.ToString(); Drawings.s_DrawDirection = (result.CastPosition - s.From.To2D()).Normalized().Perpendicular(); Drawings.s_DrawWidth = (int)ringRadius; if (result.HitChance >= hc) { s.Cast(result.CastPosition); return(true); } return(false); }
private Tuple<int, Vector3> BestQPosition(Obj_AI_Base target, List<Obj_AI_Base> targets, HitChance hitChance) { var castPos = Vector3.Zero; var totalHits = 0; try { var enemies = targets.Where(e => e.IsValidTarget(Q.Range * 1.5f)).ToList(); var enemyPositions = new List<Tuple<Obj_AI_Base, Vector3>>(); var circle = new Geometry.Polygon.Circle(Player.Position, Player.BoundingRadius, 30).Points; foreach (var h in enemies) { var ePred = Q.GetPrediction(h); if (ePred.Hitchance >= hitChance) { circle.Add(Player.Position.Extend(ePred.UnitPosition, Player.BoundingRadius).To2D()); enemyPositions.Add(new Tuple<Obj_AI_Base, Vector3>(h, ePred.UnitPosition)); } } var targetPos = target == null ? Vector3.Zero : target.Position; if (target == null) { var possibilities = ListExtensions.ProduceEnumeration(enemyPositions).Where(p => p.Count > 0).ToList(); var count = 0; foreach (var possibility in possibilities) { var mec = MEC.GetMec(possibility.Select(p => p.Item2.To2D()).ToList()); if (mec.Radius < Q.Width && possibility.Count > count) { count = possibility.Count; targetPos = mec.Center.To3D(); } } } if (targetPos.Equals(Vector3.Zero)) { return new Tuple<int, Vector3>(totalHits, castPos); } circle = circle.OrderBy(c => c.Distance(targetPos)).ToList(); if (!enemyPositions.Any()) { return new Tuple<int, Vector3>(totalHits, castPos); } foreach (var point in circle) { var hits = 0; var containsTarget = false; var direction = Q.Range * (point.To3D() - ObjectManager.Player.Position).Normalized().To2D(); var rect1 = new Geometry.Polygon.Rectangle( Player.Position, Player.Position.Extend(Player.Position + direction.To3D(), Q.Range), Q.Width); var rect2 = new Geometry.Polygon.Rectangle( Player.Position, Player.Position.Extend(Player.Position + direction.Rotated(QAngle).To3D(), Q.Range), Q.Width); var rect3 = new Geometry.Polygon.Rectangle( Player.Position, Player.Position.Extend(Player.Position + direction.Rotated(-QAngle).To3D(), Q.Range), Q.Width); foreach (var enemy in enemyPositions) { var bounding = new Geometry.Polygon.Circle(enemy.Item2, enemy.Item1.BoundingRadius * 0.85f); if (bounding.Points.Any(p => rect1.IsInside(p) || rect2.IsInside(p) || rect3.IsInside(p))) { hits++; if (target != null && enemy.Item1.NetworkId.Equals(target.NetworkId)) { containsTarget = true; } } } if ((containsTarget || target == null) && hits > totalHits) { totalHits = hits; castPos = Player.Position.Extend(point.To3D(), Q.Range); if (totalHits >= enemies.Count) { break; } } } } catch (Exception ex) { Global.Logger.AddItem(new LogItem(ex)); } return new Tuple<int, Vector3>(totalHits, castPos); }
public static Slider CreateHitChanceSlider(string identifier, string displayName, HitChance defaultValue, Menu menu) { var slider = menu.Add(identifier, new Slider(displayName, (int)defaultValue, 0, 8)); var hcNames = new[] { "Unknown", "Impossible", "Collision", "Low", "AveragePoint", "Medium", "High", "Dashing", "Immobile" }; slider.DisplayName = hcNames[slider.CurrentValue]; slider.OnValueChange += delegate(ValueBase <int> sender, ValueBase <int> .ValueChangeArgs changeArgs) { sender.DisplayName = hcNames[changeArgs.NewValue]; }; return(slider); }
/// <summary> /// Casts the spell. /// </summary> /// <param name="unit">Unit to cast on</param> /// <param name="exactHitChance">Is exact hit chance</param> /// <param name="areaOfEffect">Is Area of Effect</param> /// <param name="minTargets">Minimum of Targets</param> /// <param name="tempHitChance">Temporary HitChance Override</param> /// <returns>The <see cref="CastStates" /></returns> public CastStates Cast( Obj_AI_Base unit, bool exactHitChance = false, bool areaOfEffect = false, int minTargets = -1, HitChance tempHitChance = HitChance.None) { if (!unit.IsValid()) { return(CastStates.InvalidTarget); } if (!this.Slot.IsReady()) { return(CastStates.NotReady); } if (!areaOfEffect && minTargets != -1) { areaOfEffect = true; } if (!this.IsSkillshot) { if (this.RangeCheckFrom.DistanceSquared(unit.ServerPosition) > this.RangeSqr) { return(CastStates.OutOfRange); } this.LastCastAttemptT = Variables.TickCount; return(!GameObjects.Player.Spellbook.CastSpell(this.Slot, unit) ? CastStates.NotCasted : CastStates.SuccessfullyCasted); } var prediction = this.GetPrediction(unit, areaOfEffect); if (minTargets != -1 && prediction.AoeTargetsHitCount <= minTargets) { return(CastStates.NotEnoughTargets); } if (prediction.CollisionObjects.Count > 0) { return(CastStates.Collision); } if (this.RangeCheckFrom.DistanceSquared(prediction.CastPosition) > this.RangeSqr) { return(CastStates.OutOfRange); } if (prediction.Hitchance < ((tempHitChance == HitChance.None) ? this.MinHitChance : tempHitChance) || (exactHitChance && prediction.Hitchance != ((tempHitChance == HitChance.None) ? this.MinHitChance : tempHitChance))) { return(CastStates.LowHitChance); } this.LastCastAttemptT = Variables.TickCount; if (this.IsChargedSpell) { if (this.IsCharging) { ShootChargedSpell(this.Slot, prediction.CastPosition); } else { this.StartCharging(); } } else { if (!GameObjects.Player.Spellbook.CastSpell(this.Slot, prediction.CastPosition)) { return(CastStates.NotCasted); } } return(CastStates.SuccessfullyCasted); }
/// <summary> /// If the Spell has a certain hitchance and is ready to cast and if the target is valid /// </summary> /// <param name="unit"></param> /// <param name="minHitChance"></param> /// <param name="aoe"></param> /// <returns></returns> public bool CouldHit(Obj_AI_Base unit, HitChance minHitChance = HitChance.Low, bool aoe = false) { return(GetPrediction(unit, aoe).Hitchance >= minHitChance && CanBeCast() && unit.IsValidTarget()); }
static void farmChance_ValueChanged(object sender, OnValueChangeEventArgs e) { FarmHitChance = (HitChance)(e.GetNewValue <StringList>().SelectedIndex + 4); }
/// <summary> /// Quick and Easy Spellcasts params for Lux /// </summary> /// <param name="target"></param> Which unit should we cast spells on /// <param name="range"></param> Range check for targets /// <param name="spellslot"></param> Which spellslot /// <param name="collision"></param> Collision Check for Q usage /// <param name="count"></param> Only use said ability if it can hit X amount of enemies /// <param name="objectcheck"></param> Objectcheck for E usage public static void SpellCast(Obj_AI_Hero target, float range, Spell spell, bool collision, byte count, bool objectcheck, HitChance Hitchance) { var CastPosition = Prediction.GetPrediction(target, 0.25f); if (spell.IsReady() && target.IsValidTarget(range) && CastPosition.Hitchance >= Hitchance && !collision && !objectcheck) { spell.Cast(target); } if (spell.IsReady() && target.IsValidTarget(range) && collision && CastPosition.Hitchance >= Hitchance && Q1.GetPrediction(target).CollisionObjects.Count() <= 1 && !objectcheck) { spell.Cast(target); } if (Lux_E == null && spell.IsReady() && objectcheck && target.IsValidTarget(E1.Range) && CastPosition.Hitchance >= Hitchance && !collision) { spell.Cast(target); } }
public static void AddHitChance(this Menu menu, string name, string displayName, HitChance defaultHitChance) { menu.AddItem( new MenuItem(name + ObjectHandler.Player.ChampionName, displayName).SetValue( new StringList((new[] { "Low", "Medium", "High", "Very High" }), (int)defaultHitChance - 3))); }
/// <summary> /// Spell extension for cast vector spell with SPrediction /// </summary> /// <param name="s">Spell to cast</param> /// <param name="t">Target for spell</param> /// <param name="vectorLenght">Vector lenght</param> /// <param name="hc">Minimum HitChance to cast</param> /// <param name="reactionIgnoreDelay">Delay to ignore target's reaction time</param> /// <param name="minHit">Minimum Hit Count to cast</param> /// <param name="rangeCheckFrom">Position where spell will be casted from</param> /// <param name="filterHPPercent">Minimum HP Percent to cast (for target)</param> /// <returns>true if spell has casted</returns> public static bool SPredictionCastVector(this Spell s, AIHeroClient t, float vectorLenght, HitChance hc, int reactionIgnoreDelay = 0, byte minHit = 1, Vector3?rangeCheckFrom = null, float filterHPPercent = 100) { if (ConfigMenu.SelectedPrediction.SelectedIndex == 1) { throw new NotSupportedException("Vector Prediction not supported in Common prediction"); } if (minHit > 1) { return(SPredictionCastAoeVector(s, vectorLenght, minHit)); } if (t.HealthPercent > filterHPPercent) { return(false); } if (rangeCheckFrom == null) { rangeCheckFrom = ObjectManager.Player.ServerPosition; } float avgt = t.AvgMovChangeTime() + reactionIgnoreDelay; float movt = t.LastMovChangeTime(); float avgp = t.AvgPathLenght(); var result = VectorPrediction.GetPrediction(t, s.Width, s.Delay, s.Speed, s.Range, vectorLenght, t.GetWaypoints(), avgt, movt, avgp, s.RangeCheckFrom.To2D()); if (result.HitChance >= hc) { s.Cast(result.CastSourcePosition, result.CastTargetPosition); return(true); } return(false); }
private Tuple <int, Vector3> BestQPosition(Obj_AI_Base target, List <Obj_AI_Base> targets, HitChance hitChance) { var castPos = Vector3.Zero; var totalHits = 0; try { var enemies = targets.Where(e => e.IsValidTarget(Q.Range * 1.5f)).ToList(); var enemyPositions = new List <Tuple <Obj_AI_Base, Vector3> >(); var circle = new Geometry.Polygon.Circle(Player.Position, Player.BoundingRadius, 30).Points; foreach (var h in enemies) { var ePred = Q.GetPrediction(h); if (ePred.Hitchance >= hitChance) { circle.Add(Player.Position.Extend(ePred.UnitPosition, Player.BoundingRadius).To2D()); enemyPositions.Add(new Tuple <Obj_AI_Base, Vector3>(h, ePred.UnitPosition)); } } var targetPos = target?.Position ?? Vector3.Zero; if (target == null) { var possibilities = ListExtensions.ProduceEnumeration(enemyPositions).Where(p => p.Count > 0).ToList(); var count = 0; foreach (var possibility in possibilities) { var mec = MEC.GetMec(possibility.Select(p => p.Item2.To2D()).ToList()); if (mec.Radius < Q.Width && possibility.Count > count) { count = possibility.Count; targetPos = mec.Center.To3D(); } } } if (targetPos.Equals(Vector3.Zero)) { return(new Tuple <int, Vector3>(totalHits, castPos)); } circle = circle.OrderBy(c => c.Distance(targetPos)).ToList(); if (!enemyPositions.Any()) { return(new Tuple <int, Vector3>(totalHits, castPos)); } foreach (var point in circle) { var hits = 0; var containsTarget = false; var direction = Q.Range * (point.To3D() - Player.Position).Normalized().To2D(); var rect1 = new Geometry.Polygon.Rectangle( Player.Position, Player.Position.Extend(Player.Position + direction.To3D(), Q.Range), Q.Width); var rect2 = new Geometry.Polygon.Rectangle( Player.Position, Player.Position.Extend(Player.Position + direction.Rotated(QAngle).To3D(), Q.Range), Q.Width); var rect3 = new Geometry.Polygon.Rectangle( Player.Position, Player.Position.Extend(Player.Position + direction.Rotated(-QAngle).To3D(), Q.Range), Q.Width); foreach (var enemy in enemyPositions) { var bounding = new Geometry.Polygon.Circle(enemy.Item2, enemy.Item1.BoundingRadius * 0.85f); if (bounding.Points.Any(p => rect1.IsInside(p) || rect2.IsInside(p) || rect3.IsInside(p))) { hits++; if (target != null && enemy.Item1.NetworkId.Equals(target.NetworkId)) { containsTarget = true; } } } if ((containsTarget || target == null) && hits > totalHits) { totalHits = hits; castPos = Player.Position.Extend(point.To3D(), Q.Range); if (totalHits >= enemies.Count) { break; } } } } catch (Exception ex) { Global.Logger.AddItem(new LogItem(ex)); } return(new Tuple <int, Vector3>(totalHits, castPos)); }
/// <summary> /// Spell extension for cast spell with SPrediction /// </summary> /// <param name="s">Spell to cast</param> /// <param name="t">Target for spell</param> /// <param name="hc">Minimum HitChance to cast</param> /// <param name="reactionIgnoreDelay">Delay to ignore target's reaction time</param> /// <param name="minHit">Minimum Hit Count to cast</param> /// <param name="rangeCheckFrom">Position where spell will be casted from</param> /// <param name="filterHPPercent">Minimum HP Percent to cast (for target)</param> /// <returns>true if spell has casted</returns> public static bool SPredictionCast(this Spell s, AIHeroClient t, HitChance hc, int reactionIgnoreDelay = 0, byte minHit = 1, Vector3?rangeCheckFrom = null, float filterHPPercent = 100) { if (rangeCheckFrom == null) { rangeCheckFrom = ObjectManager.Player.ServerPosition; } if (t == null) { return(s.Cast()); } if (!s.IsSkillshot) { return(s.Cast(t) == Spell.CastStates.SuccessfullyCasted); } #region if common prediction selected if (ConfigMenu.SelectedPrediction.SelectedIndex == 1) { var pout = s.GetPrediction(t, minHit > 1); if (minHit > 1) { if (pout.AoeTargetsHitCount >= minHit) { return(s.Cast(pout.CastPosition)); } else { return(false); } } if (pout.Hitchance >= hc) { return(s.Cast(pout.CastPosition)); } else { return(false); } } #endregion if (minHit > 1) { return(SPredictionCastAoe(s, minHit)); } if (t.HealthPercent > filterHPPercent) { return(false); } float avgt = t.AvgMovChangeTime() + reactionIgnoreDelay; float movt = t.LastMovChangeTime(); float avgp = t.AvgPathLenght(); var waypoints = t.GetWaypoints(); Prediction.Result result; switch (s.Type) { case SkillshotType.SkillshotLine: result = LinePrediction.GetPrediction(t, s.Width, s.Delay, s.Speed, s.Range, s.Collision, waypoints, avgt, movt, avgp, t.LastAngleDiff(), s.From.To2D(), s.RangeCheckFrom.To2D()); break; case SkillshotType.SkillshotCircle: result = CirclePrediction.GetPrediction(t, s.Width, s.Delay, s.Speed, s.Range, s.Collision, waypoints, avgt, movt, avgp, t.LastAngleDiff(), s.From.To2D(), s.RangeCheckFrom.To2D()); break; case SkillshotType.SkillshotCone: result = ConePrediction.GetPrediction(t, s.Width, s.Delay, s.Speed, s.Range, s.Collision, waypoints, avgt, movt, avgp, t.LastAngleDiff(), s.From.To2D(), s.RangeCheckFrom.To2D()); break; default: throw new InvalidOperationException("Unknown spell type"); } Drawings.s_DrawTick = Utils.TickCount; Drawings.s_DrawPos = result.CastPosition; Drawings.s_DrawHitChance = result.HitChance.ToString(); Drawings.s_DrawDirection = (result.CastPosition - s.From.To2D()).Normalized().Perpendicular(); Drawings.s_DrawWidth = (int)s.Width; if (result.HitChance >= hc) { s.Cast(result.CastPosition); return(true); } return(false); }
/// <summary> /// Gets all of the units that this spell can hit that is greater then or equal to the <see cref="HitChance" /> /// provided. /// </summary> /// <param name="minimumHitChance">Minimum HitChance</param> /// <returns> /// All of the units that this spell can hit that is greater then or equal to the <see cref="HitChance" /> /// provided. /// </returns> public IEnumerable <Obj_AI_Base> GetUnitsByHitChance(HitChance minimumHitChance = HitChance.High) { return (GameObjects.Enemy.Where( unit => this.WillHit(unit, GameObjects.Player.ServerPosition, 0, minimumHitChance))); }
/// <summary> /// Spell extension for cast vector spell with SPrediction /// </summary> /// <param name="s">Spell to cast</param> /// <param name="t">Target for spell</param> /// <param name="vectorLenght">Vector lenght</param> /// <param name="hc">Minimum HitChance to cast</param> /// <param name="reactionIgnoreDelay">Delay to ignore target's reaction time</param> /// <param name="minHit">Minimum Hit Count to cast</param> /// <param name="rangeCheckFrom">Position where spell will be casted from</param> /// <param name="filterHPPercent">Minimum HP Percent to cast (for target)</param> /// <returns>true if spell has casted</returns> public static bool SPredictionCastVector(this Spell s, Obj_AI_Hero t, float vectorLenght, HitChance hc, int reactionIgnoreDelay = 0, byte minHit = 1, Vector3?rangeCheckFrom = null, float filterHPPercent = 100) { if (Prediction.predMenu != null && Prediction.predMenu.Item("PREDICTONLIST").GetValue <StringList>().SelectedIndex == 1) { throw new NotSupportedException("Vector Prediction not supported in Common prediction"); } if (minHit > 1) { return(SPredictionCastAoeVector(s, vectorLenght, minHit)); } if (t.HealthPercent > filterHPPercent) { return(false); } if (rangeCheckFrom == null) { rangeCheckFrom = ObjectManager.Player.ServerPosition; } if (Monitor.TryEnter(PathTracker.EnemyInfo[t.NetworkId].m_lock)) { try { float avgt = t.AvgMovChangeTime() + reactionIgnoreDelay; float movt = t.LastMovChangeTime(); float avgp = t.AvgPathLenght(); var result = VectorPrediction.GetPrediction(t, s.Width, s.Delay, s.Speed, s.Range, vectorLenght, t.GetWaypoints(), avgt, movt, avgp, s.RangeCheckFrom.To2D()); if (result.HitChance >= hc) { s.Cast(result.CastSourcePosition, result.CastTargetPosition); return(true); } Monitor.Pulse(PathTracker.EnemyInfo[t.NetworkId].m_lock); return(false); } finally { Monitor.Exit(PathTracker.EnemyInfo[t.NetworkId].m_lock); } } return(false); }
/// <summary> /// Gets the hit count. /// </summary> /// <param name="hitChance">The hit chance.</param> /// <returns>System.Single.</returns> public float GetHitCount(HitChance hitChance = HitChance.High) { return(HeroManager.Enemies.Select(e => GetPrediction(e)).Count(p => p.Hitchance >= hitChance)); }
/// <summary> /// Cast Spell if HitChance is more than the minimum to input HitChance /// </summary> /// <param name="unit">The Target</param> /// <param name="hitChance">The HitChance</param> /// <returns>Was Spell Casted</returns> public CastStates CastIfHitchanceMinimum(Obj_AI_Base unit, HitChance hitChance) { return(this.Cast(unit, false, false, -1, hitChance)); }
public static Result Circle(Spell spell, Obj_AI_Hero target, HitChance hitChance, bool boundingRadius = true) { try { if (spell == null || target == null) { return(new Result(Vector3.Zero, new List <Obj_AI_Hero>())); } var hits = new List <Obj_AI_Hero>(); var center = Vector3.Zero; var radius = float.MaxValue; var range = spell.Range + (spell.Width * 0.85f) + (boundingRadius ? target.BoundingRadius * BoundingRadiusMultiplicator : 0); var positions = (from t in GameObjects.EnemyHeroes where t.IsValidTarget(range * 1.5f, true, spell.RangeCheckFrom) let prediction = spell.GetPrediction(t) where prediction.Hitchance >= hitChance select new Position(t, prediction.UnitPosition)).ToList(); var spellWidth = spell.Width; //+ (boundingRadius ? positions.Select(p => p.Hero).Min(p => p.BoundingRadius) : 0); if (positions.Any()) { var mainTarget = positions.FirstOrDefault(p => p.Hero.NetworkId == target.NetworkId); var possibilities = ListExtensions.ProduceEnumeration( positions.Where( p => p.UnitPosition.Distance(mainTarget.UnitPosition) <= spell.Width * 0.85f).ToList()) .Where(p => p.Count > 0 && p.Any(t => t.Hero.NetworkId == mainTarget.Hero.NetworkId)) .ToList(); foreach (var possibility in possibilities) { var mec = MEC.GetMec(possibility.Select(p => p.UnitPosition.To2D()).ToList()); var distance = spell.From.Distance(mec.Center.To3D()); if (mec.Radius < spellWidth && distance < range) { var lHits = new List <Obj_AI_Hero>(); var circle = new Geometry.Polygon.Circle( spell.From.Extend( mec.Center.To3D(), spell.Range > distance ? distance : spell.Range), spell.Width); if (boundingRadius) { lHits.AddRange( (from position in positions where new Geometry.Polygon.Circle( position.UnitPosition, (position.Hero.BoundingRadius * BoundingRadiusMultiplicator)).Points.Any (p => circle.IsInside(p)) select position.Hero)); } else { lHits.AddRange( from position in positions where circle.IsInside(position.UnitPosition) select position.Hero); } if ((lHits.Count > hits.Count || lHits.Count == hits.Count && mec.Radius < radius || lHits.Count == hits.Count && spell.From.Distance(circle.Center.To3D()) < spell.From.Distance(center)) && lHits.Any(p => p.NetworkId == target.NetworkId)) { center = circle.Center.To3D2(); radius = mec.Radius; hits.Clear(); hits.AddRange(lHits); } } } if (!center.Equals(Vector3.Zero)) { return(new Result(center, hits)); } } } catch (Exception ex) { Global.Logger.AddItem(new LogItem(ex)); } return(new Result(Vector3.Zero, new List <Obj_AI_Hero>())); }
/// <summary> /// Spell extension for cast spell with SPrediction /// </summary> /// <param name="s">Spell to cast</param> /// <param name="t">Target for spell</param> /// <param name="hc">Minimum HitChance to cast</param> /// <param name="reactionIgnoreDelay">Delay to ignore target's reaction time</param> /// <param name="minHit">Minimum Hit Count to cast</param> /// <param name="rangeCheckFrom">Position where spell will be casted from</param> /// <param name="filterHPPercent">Minimum HP Percent to cast (for target)</param> /// <returns>true if spell has casted</returns> public static bool SPredictionCast(this Spell s, Obj_AI_Hero t, HitChance hc, int reactionIgnoreDelay = 0, byte minHit = 1, Vector3?rangeCheckFrom = null, float filterHPPercent = 100) { if (rangeCheckFrom == null) { rangeCheckFrom = ObjectManager.Player.ServerPosition; } if (t == null) { return(s.Cast()); } if (!s.IsSkillshot) { return(s.Cast(t) == Spell.CastStates.SuccessfullyCasted); } #region if common prediction selected if (Prediction.predMenu != null && Prediction.predMenu.Item("PREDICTONLIST").GetValue <StringList>().SelectedIndex == 1) { var pout = s.GetPrediction(t, minHit > 1); if (minHit > 1) { if (pout.AoeTargetsHitCount >= minHit) { return(s.Cast(pout.CastPosition)); } else { return(false); } } if (pout.Hitchance >= hc) { return(s.Cast(pout.CastPosition)); } else { return(false); } } #endregion if (minHit > 1) { return(SPredictionCastAoe(s, minHit)); } if (t.HealthPercent > filterHPPercent) { return(false); } if (Monitor.TryEnter(PathTracker.EnemyInfo[t.NetworkId].m_lock)) { try { float avgt = t.AvgMovChangeTime() + reactionIgnoreDelay; float movt = t.LastMovChangeTime(); float avgp = t.AvgPathLenght(); var waypoints = t.GetWaypoints(); Prediction.Result result; switch (s.Type) { case SkillshotType.SkillshotLine: result = LinePrediction.GetPrediction(t, s.Width, s.Delay, s.Speed, s.Range, s.Collision, waypoints, avgt, movt, avgp, t.LastAngleDiff(), s.From.To2D(), s.RangeCheckFrom.To2D()); break; case SkillshotType.SkillshotCircle: result = CirclePrediction.GetPrediction(t, s.Width, s.Delay, s.Speed, s.Range, s.Collision, waypoints, avgt, movt, avgp, t.LastAngleDiff(), s.From.To2D(), s.RangeCheckFrom.To2D()); break; case SkillshotType.SkillshotCone: result = ConePrediction.GetPrediction(t, s.Width, s.Delay, s.Speed, s.Range, s.Collision, waypoints, avgt, movt, avgp, t.LastAngleDiff(), s.From.To2D(), s.RangeCheckFrom.To2D()); break; default: throw new InvalidOperationException("Unknown spell type"); } Prediction.lastDrawTick = Utils.TickCount; Prediction.lastDrawPos = result.CastPosition; Prediction.lastDrawHitchance = result.HitChance.ToString(); Prediction.lastDrawDirection = (result.CastPosition - s.From.To2D()).Normalized().Perpendicular(); Prediction.lastDrawWidth = (int)s.Width; if (result.HitChance >= hc) { s.Cast(result.CastPosition); return(true); } Monitor.Pulse(PathTracker.EnemyInfo[t.NetworkId].m_lock); return(false); } finally { Monitor.Exit(PathTracker.EnemyInfo[t.NetworkId].m_lock); } } return(false); }
protected static void Postfix(Projectile __instance, ref Thing thing, ref bool __result) { if (__result == false) { return; } if (thing != null && !(thing is Pawn)) { return; } Thing launcher = (Thing)LauncherField.GetValue(__instance); // If nobody launched this, do nothing if (launcher == null) { return; } if (thing != null) { LocalTargetInfo intendedTargetInfo = (LocalTargetInfo)IntendedTargetField.GetValue(__instance); // If they're specifically targeted, do nothing if (intendedTargetInfo != null && intendedTargetInfo.Thing == thing) { return; } // If the launcher of the bullet is hostile to us, do nothing if (launcher.HostileTo(thing.Faction)) { return; } } // If this is a friendly turret... if (launcher is Building_TurretGun) { if (thing != null && !launcher.HostileTo(thing.Faction)) { if (Settings.HitChance.TurretHitChance != 100 && (Settings.HitChance.TurretHitChance == 0 || HitChance.Test(Settings.HitChance.TurretHitChance))) { __result = false; } } return; } if (launcher is Pawn pawn && Settings.HitChance.BaseHitChance != 100 && (Settings.HitChance.BaseHitChance == 0 || HitChance.Test(pawn))) { __result = false; } }
/// <summary> /// Returns Hit Count /// </summary> /// <param name="hitChance">The HitChance</param> /// <returns>Hit Count</returns> public float GetHitCount(HitChance hitChance = HitChance.High) { return(GameObjects.EnemyHeroes.Select(e => this.GetPrediction(e)).Count(p => p.Hitchance >= hitChance)); }
public static void SkillShot(Spell spell, HitChance hitChance, bool boundingRadius = true, bool maxRange = true) { SkillShot(TargetSelector.GetTarget(spell), spell, hitChance); }
public static bool CanCastSpellPred(Spell QWER, Obj_AI_Base target) { int predIndex = 0; HitChance hitchance = HitChance.Low; if (QWER.Slot == SpellSlot.Q) { predIndex = MainMenu.Item("Qpred", true).GetValue <StringList>().SelectedIndex; if (MainMenu.Item("QHitChance", true).GetValue <StringList>().SelectedIndex == 0) { hitchance = HitChance.VeryHigh; } else if (MainMenu.Item("QHitChance", true).GetValue <StringList>().SelectedIndex == 1) { hitchance = HitChance.High; } else if (MainMenu.Item("QHitChance", true).GetValue <StringList>().SelectedIndex == 2) { hitchance = HitChance.Medium; } } else if (QWER.Slot == SpellSlot.W) { predIndex = MainMenu.Item("Wpred", true).GetValue <StringList>().SelectedIndex; if (MainMenu.Item("WHitChance", true).GetValue <StringList>().SelectedIndex == 0) { hitchance = HitChance.VeryHigh; } else if (MainMenu.Item("WHitChance", true).GetValue <StringList>().SelectedIndex == 1) { hitchance = HitChance.High; } else if (MainMenu.Item("WHitChance", true).GetValue <StringList>().SelectedIndex == 2) { hitchance = HitChance.Medium; } } else if (QWER.Slot == SpellSlot.E) { predIndex = MainMenu.Item("Epred", true).GetValue <StringList>().SelectedIndex; if (MainMenu.Item("EHitChance", true).GetValue <StringList>().SelectedIndex == 0) { hitchance = HitChance.VeryHigh; } else if (MainMenu.Item("EHitChance", true).GetValue <StringList>().SelectedIndex == 1) { hitchance = HitChance.High; } else if (MainMenu.Item("EHitChance", true).GetValue <StringList>().SelectedIndex == 2) { hitchance = HitChance.Medium; } } else if (QWER.Slot == SpellSlot.R) { predIndex = MainMenu.Item("Rpred", true).GetValue <StringList>().SelectedIndex; if (MainMenu.Item("RHitChance", true).GetValue <StringList>().SelectedIndex == 0) { hitchance = HitChance.VeryHigh; } else if (MainMenu.Item("RHitChance", true).GetValue <StringList>().SelectedIndex == 1) { hitchance = HitChance.High; } else if (MainMenu.Item("RHitChance", true).GetValue <StringList>().SelectedIndex == 2) { hitchance = HitChance.Medium; } } if (predIndex == 3) { SkillshotType CoreType2 = SkillshotType.SkillshotLine; bool aoe2 = false; if (QWER.Width > 80 && !QWER.Collision) { aoe2 = true; } var predInput2 = new PredictionInput { Aoe = aoe2, Collision = QWER.Collision, Speed = QWER.Speed, Delay = QWER.Delay, Range = QWER.Range, From = Player.ServerPosition, Radius = QWER.Width, Unit = target, Type = CoreType2 }; var poutput2 = Prediction.GetPrediction(predInput2); if (QWER.Speed != float.MaxValue && OktwCommon.CollisionYasuo(Player.ServerPosition, poutput2.CastPosition)) { return(false); } if ((int)hitchance == 6) { if (poutput2.Hitchance >= HitChance.VeryHigh) { return(true); } else if (predInput2.Aoe && poutput2.AoeTargetsHitCount > 1 && poutput2.Hitchance >= HitChance.High) { return(true); } } else if ((int)hitchance == 5) { if (poutput2.Hitchance >= HitChance.High) { return(true); } } else if ((int)hitchance == 4) { if (poutput2.Hitchance >= HitChance.Medium) { return(true); } } } else if (predIndex == 1) { SkillshotType CoreType2 = SkillshotType.SkillshotLine; bool aoe2 = false; if (QWER.Type == SkillshotType.SkillshotCircle) { CoreType2 = SkillshotType.SkillshotCircle; aoe2 = true; } if (QWER.Width > 80 && !QWER.Collision) { aoe2 = true; } var predInput2 = new PredictionInput { Aoe = aoe2, Collision = QWER.Collision, Speed = QWER.Speed, Delay = QWER.Delay, Range = QWER.Range, From = Player.ServerPosition, Radius = QWER.Width, Unit = target, Type = CoreType2 }; var poutput2 = Prediction.GetPrediction(predInput2); //var poutput2 = QWER.GetPrediction(target); if (QWER.Speed != float.MaxValue && OktwCommon.CollisionYasuo(Player.ServerPosition, poutput2.CastPosition)) { return(false); } if ((int)hitchance == 6) { if (poutput2.Hitchance >= HitChance.VeryHigh) { return(true); } else if (predInput2.Aoe && poutput2.AoeTargetsHitCount > 1 && poutput2.Hitchance >= HitChance.High) { return(true); } } else if ((int)hitchance == 5) { if (poutput2.Hitchance >= HitChance.High) { return(true); } } else if ((int)hitchance == 4) { if (poutput2.Hitchance >= HitChance.Medium) { return(true); } } if (Game.Time - DrawSpellTime > 0.5) { DrawSpell = QWER; DrawSpellTime = Game.Time; } DrawSpellPos = poutput2; } else if (predIndex == 0) { return(QWER.GetPrediction(target).Hitchance >= hitchance); } else if (predIndex == 2) { return(QWER.GetPrediction(target).Hitchance >= HitChance.High); } return(false); }