/// <summary> /// Gets Prediction result /// </summary> /// <param name="target">Target</param> /// <returns>Prediction result as <see cref="Prediction.Result"/></returns> public static Prediction.Result GetSPrediction(this Spell s, Obj_AI_Hero target) { switch (s.Type) { case SkillshotType.SkillshotLine: return LinePrediction.GetPrediction(target, s.Width, s.Delay, s.Speed, s.Range, s.Collision, target.GetWaypoints(), target.AvgMovChangeTime(), target.LastMovChangeTime(), target.AvgPathLenght(), target.LastAngleDiff(), s.From.To2D(), s.RangeCheckFrom.To2D()); case SkillshotType.SkillshotCircle: return CirclePrediction.GetPrediction(target, s.Width, s.Delay, s.Speed, s.Range, s.Collision, target.GetWaypoints(), target.AvgMovChangeTime(), target.LastMovChangeTime(), target.AvgPathLenght(), target.LastAngleDiff(), s.From.To2D(), s.RangeCheckFrom.To2D()); case SkillshotType.SkillshotCone: return ConePrediction.GetPrediction(target, s.Width, s.Delay, s.Speed, s.Range, s.Collision, target.GetWaypoints(), target.AvgMovChangeTime(), target.LastMovChangeTime(), target.AvgPathLenght(), target.LastAngleDiff(), s.From.To2D(), s.RangeCheckFrom.To2D()); } throw new NotSupportedException("Unknown skill shot type"); }
public Input(Obj_AI_Base _target, Spell s, Vector3 _from, Vector3 _rangeCheckFrom) { Target = _target; SpellDelay = s.Delay; SpellMissileSpeed = s.Speed; SpellWidth = s.Width; SpellRange = s.Range; SpellCollisionable = s.Collision; SpellSkillShotType = s.Type; Path = Target.GetWaypoints(); if (Target is Obj_AI_Hero) { Obj_AI_Hero t = Target as Obj_AI_Hero; AvgReactionTime = t.AvgMovChangeTime(); LastMovChangeTime = t.LastMovChangeTime(); AvgPathLenght = t.AvgPathLenght(); } else { AvgReactionTime = 0; LastMovChangeTime = 0; AvgPathLenght = 0; } From = _from; RangeCheckFrom = _rangeCheckFrom; }
public Input(Obj_AI_Base _target, float delay, float speed, float radius, float range, bool collision, SkillshotType type, Vector3 _from, Vector3 _rangeCheckFrom) { Target = _target; SpellDelay = delay; SpellMissileSpeed = speed; SpellWidth = radius; SpellRange = range; SpellCollisionable = collision; SpellSkillShotType = type; Path = Target.GetWaypoints(); if (Target is Obj_AI_Hero) { Obj_AI_Hero t = Target as Obj_AI_Hero; AvgReactionTime = t.AvgMovChangeTime(); LastMovChangeTime = t.LastMovChangeTime(); AvgPathLenght = t.AvgPathLenght(); LastAngleDiff = t.LastAngleDiff(); } else { AvgReactionTime = 0; LastMovChangeTime = 0; AvgPathLenght = 0; LastAngleDiff = 0; } From = _from; RangeCheckFrom = _rangeCheckFrom; }
/// <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 (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); }
/// <summary> /// Spell extension for cast arc 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> /// <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 (minHit > 1) { throw new NotSupportedException("Vector aoe prediction has not supported yet"); } if (Prediction.predMenu != null && Prediction.predMenu.Item("PREDICTONLIST").GetValue <StringList>().SelectedIndex == 1) { throw new NotSupportedException("Vector Prediction not supported in Common prediction"); } 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> /// Spell extension for cast arc 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 SPredictionCastArc(this Spell s, Obj_AI_Hero t, HitChance hc, bool arconly = true, int reactionIgnoreDelay = 0, byte minHit = 1, Vector3?rangeCheckFrom = null, float filterHPPercent = 100) { if (ConfigMenu.SelectedPrediction.SelectedIndex == 1) { throw new NotSupportedException("Arc Prediction not supported in Common prediction"); } if (minHit > 1) { return(SPredictionCastAoeArc(s, 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 = ArcPrediction.GetPrediction(t, s.Width, s.Delay, s.Speed, s.Range, s.Collision, t.GetWaypoints(), avgt, movt, avgp, t.LastAngleDiff(), s.From.To2D(), s.RangeCheckFrom.To2D(), arconly); 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> /// 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 (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); }
/// <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 (minHit > 1) throw new NotSupportedException("Vector aoe prediction has not supported yet"); if (Prediction.predMenu != null && Prediction.predMenu.Item("PREDICTONLIST").GetValue<StringList>().SelectedIndex == 1) throw new NotSupportedException("Vector Prediction not supported in Common prediction"); 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> /// 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, 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, 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, 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; }
/// <summary> /// Gets Prediction result /// </summary> /// <param name="target">Target for spell</param> /// <param name="width">Vector width</param> /// <param name="delay">Spell delay</param> /// <param name="vectorSpeed">Vector speed</param> /// <param name="range">Spell range</param> /// <param name="vectorLenght">Vector lenght</param> /// <returns>Prediction result as <see cref="Prediction.Vector.Result"/></returns> public static Result GetPrediction(Obj_AI_Hero target, float width, float delay, float vectorSpeed, float range, float vectorLenght) { return GetPrediction(target, width, delay, vectorSpeed, range, vectorSpeed, target.GetWaypoints(), target.AvgMovChangeTime(), target.LastMovChangeTime(), target.AvgPathLenght(), ObjectManager.Player.ServerPosition.To2D()); }
/// <summary> /// Gets Prediction result /// </summary> /// <param name="target">Target</param> /// <param name="vectorLenght">Vector Lenght</param> /// <returns>Prediction result as <see cref="Prediction.Vector.Result"/></returns> public static VectorPrediction.Result GetVectorSPrediction(this Spell s, Obj_AI_Hero target, float vectorLenght) { return(VectorPrediction.GetPrediction(target, s.Width, s.Delay, s.Speed, s.Range, vectorLenght, target.GetWaypoints(), target.AvgMovChangeTime(), target.LastMovChangeTime(), target.AvgPathLenght(), s.RangeCheckFrom.To2D())); }
private static void Combo() { Obj_AI_Hero tar = _q.GetTarget(); if (tar == null) { return; } HitChance hc; Vector2 pred = SPrediction.Prediction.GetPrediction(tar, _q, tar.GetWaypoints(), tar.AvgMovChangeTime(), tar.LastMovChangeTime(), tar.AvgPathLenght(), out hc, Player.Position); try { _q.SPredictionCast(tar, hc); float distance = Player.Distance(tar); float travelTime = _q.GetTravelTime(distance); _lastCast = "Distance(units): " + distance + " TravelTime(sec): " + travelTime + " Hitchance: " + hc; } catch (Exception) { // ignored } }
/// <summary> /// Casts aoe spell /// </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="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> internal static bool SPredictionCast(Spell s, Obj_AI_Hero t, HitChance hc, int reactionIgnoreDelay = 0, byte minHit = 2, Vector3? rangeCheckFrom = null, float filterHPPercent = 0) { if (!blInitialized) throw new Exception("Prediction is not initalized"); if (rangeCheckFrom == null) rangeCheckFrom = ObjectManager.Player.ServerPosition; if (Monitor.TryEnter(EnemyInfo[t.NetworkId].m_lock)) { try { HitChance predictedhc = HitChance.Impossible; float avgt = t.AvgMovChangeTime() + reactionIgnoreDelay; float movt = t.LastMovChangeTime(); float avgp = t.AvgPathLenght(); Vector2 pos = ObjectManager.Player.ServerPosition.To2D(); switch (s.Type) { case SkillshotType.SkillshotLine: pos = Line.GetPrediction(t, s, t.GetWaypoints(), avgt, movt, avgp, filterHPPercent, minHit, out predictedhc, rangeCheckFrom.Value); break; case SkillshotType.SkillshotCircle: pos = Circle.GetPrediction(t, s, t.GetWaypoints(), avgt, movt, avgp, filterHPPercent, minHit, out predictedhc, rangeCheckFrom.Value); break; case SkillshotType.SkillshotCone: pos = Cone.GetPrediction(t, s, t.GetWaypoints(), avgt, movt, avgp, filterHPPercent, minHit, out predictedhc, rangeCheckFrom.Value); break; } if (predictedhc >= hc) { s.Cast(pos); return true; } Monitor.Pulse(EnemyInfo[t.NetworkId].m_lock); return false; } finally { Monitor.Exit(EnemyInfo[t.NetworkId].m_lock); } } return false; }
/// <summary> /// Spell extension for cast arc 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 SPredictionCastArc(this Spell s, Obj_AI_Hero t, HitChance hc, bool arconly = true, int reactionIgnoreDelay = 0, byte minHit = 1, Vector3? rangeCheckFrom = null, float filterHPPercent = 100) { if (ConfigMenu.SelectedPrediction.SelectedIndex == 1) throw new NotSupportedException("Arc Prediction not supported in Common prediction"); if (minHit > 1) return SPredictionCastAoeArc(s, 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 = ArcPrediction.GetPrediction(t, s.Width, s.Delay, s.Speed, s.Range, s.Collision, t.GetWaypoints(), avgt, movt, avgp, t.LastAngleDiff(), s.From.To2D(), s.RangeCheckFrom.To2D(), arconly); 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> /// 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 (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; }
/// <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 (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; }
/// <summary> /// Gets Prediction result /// </summary> /// <param name="target">Target</param> /// <returns>Prediction result as <see cref="Prediction.Result"/></returns> public static Prediction.Result GetSPrediction(this Spell s, Obj_AI_Hero target) { #region if common prediction selected if (ConfigMenu.SelectedPrediction.SelectedIndex == 1) { var pred = s.GetPrediction(target); var result = new Prediction.Result(new Prediction.Input(target, s), target, pred.CastPosition.To2D(), pred.UnitPosition.To2D(), pred.Hitchance, default(Collision.Result)); result.Lock(false); return result; } #endregion switch (s.Type) { case SkillshotType.SkillshotLine: return LinePrediction.GetPrediction(target, s.Width, s.Delay, s.Speed, s.Range, s.Collision, target.GetWaypoints(), target.AvgMovChangeTime(), target.LastMovChangeTime(), target.AvgPathLenght(), target.LastAngleDiff(), s.From.To2D(), s.RangeCheckFrom.To2D()); case SkillshotType.SkillshotCircle: return CirclePrediction.GetPrediction(target, s.Width, s.Delay, s.Speed, s.Range, s.Collision, target.GetWaypoints(), target.AvgMovChangeTime(), target.LastMovChangeTime(), target.AvgPathLenght(), target.LastAngleDiff(), s.From.To2D(), s.RangeCheckFrom.To2D()); case SkillshotType.SkillshotCone: return ConePrediction.GetPrediction(target, s.Width, s.Delay, s.Speed, s.Range, s.Collision, target.GetWaypoints(), target.AvgMovChangeTime(), target.LastMovChangeTime(), target.AvgPathLenght(), target.LastAngleDiff(), s.From.To2D(), s.RangeCheckFrom.To2D()); } throw new NotSupportedException("Unknown skill shot type"); }
/// <summary> /// Casts spell /// </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 (predMenu != null && 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 Aoe.SPredictionCast(s, t, hc, reactionIgnoreDelay, minHit, rangeCheckFrom, filterHPPercent); if (s.Collision && minHit > 1) throw new InvalidOperationException("You can't use collisionable spells with aoe"); if (t.HealthPercent > filterHPPercent) return false; if (Monitor.TryEnter(EnemyInfo[t.NetworkId].m_lock)) { try { HitChance predictedhc; float avgt = t.AvgMovChangeTime() + reactionIgnoreDelay; float movt = t.LastMovChangeTime(); float avgp = t.AvgPathLenght(); var waypoints = t.GetWaypoints(); //PATCH WARNING Vector2 pos = GetPredictionMethod2(t, s, waypoints, avgt, movt, avgp, out predictedhc, rangeCheckFrom.Value); //if (waypoints.PathLength() / t.MoveSpeed < 1f) // pos = GetPredictionMethod2(t, s, waypoints, avgt, movt, avgp, out predictedhc, rangeCheckFrom.Value); //else // pos = GetPrediction(t, s, waypoints, avgt, movt, avgp, out predictedhc, rangeCheckFrom.Value); if (rangeCheckFrom.Value.To2D().Distance(pos) > s.Range + (s.Type == SkillshotType.SkillshotCircle ? s.Width / 2 : 0) - t.BoundingRadius) //out of range { Monitor.Pulse(EnemyInfo[t.NetworkId].m_lock); return false; } lastDrawTick = Utils.TickCount; lastDrawPos = pos; lastDrawHitchance = predictedhc.ToString(); lastDrawDirection = (pos - rangeCheckFrom.Value.To2D()).Normalized().Perpendicular(); lastDrawWidth = (int)s.Width; if (s.Collision && Collision.CheckCollision(rangeCheckFrom.Value.To2D(), pos, s, true, false, true)) { lastDrawHitchance = HitChance.Collision.ToString(); Monitor.Pulse(EnemyInfo[t.NetworkId].m_lock); return false; } if (predictedhc >= hc) { s.Cast(pos); return true; } Monitor.Pulse(EnemyInfo[t.NetworkId].m_lock); return false; } finally { Monitor.Exit(EnemyInfo[t.NetworkId].m_lock); } } return false; }
/// <summary> /// Casts spell /// </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 SPredictionCastArc(this Spell s, Obj_AI_Hero t, HitChance hc, int reactionIgnoreDelay = 0, byte minHit = 1, Vector3? rangeCheckFrom = null, float filterHPPercent = 100) { if (minHit > 1) throw new NotSupportedException("Arc aoe prediction has not supported yet"); if (predMenu != null && predMenu.Item("PREDICTONLIST").GetValue<StringList>().SelectedIndex == 1) throw new NotSupportedException("Arc Prediction not supported in Common prediction"); if (t.HealthPercent > filterHPPercent) return false; if (rangeCheckFrom == null) rangeCheckFrom = ObjectManager.Player.ServerPosition; if (Monitor.TryEnter(EnemyInfo[t.NetworkId].m_lock)) { try { HitChance predictedhc; float avgt = t.AvgMovChangeTime() + reactionIgnoreDelay; float movt = t.LastMovChangeTime(); float avgp = t.AvgPathLenght(); Vector2 pos = GetArcPrediction(t, s, t.GetWaypoints(), avgt, movt, avgp, out predictedhc, rangeCheckFrom.Value); if (rangeCheckFrom.Value.To2D().Distance(pos) > s.Range + s.Width / 2 - t.BoundingRadius) //out of range { Monitor.Pulse(EnemyInfo[t.NetworkId].m_lock); return false; } float multp = (pos.Distance(rangeCheckFrom.Value.To2D()) / 875.0f); var dianaArc = new SPrediction.Geometry.Polygon( ClipperWrapper.DefineArc(rangeCheckFrom.Value.To2D() - new Vector2(875 / 2f, 20), pos, (float)Math.PI * multp, 410, 200 * multp), ClipperWrapper.DefineArc(rangeCheckFrom.Value.To2D() - new Vector2(875 / 2f, 20), pos, (float)Math.PI * multp, 410, 320 * multp)); if (Collision.CheckYasuoWallCollision(dianaArc)) { Monitor.Pulse(EnemyInfo[t.NetworkId].m_lock); return false; } if (predictedhc >= hc) { s.Cast(pos); return true; } Monitor.Pulse(EnemyInfo[t.NetworkId].m_lock); return false; } finally { Monitor.Exit(EnemyInfo[t.NetworkId].m_lock); } } return false; }
/// <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, 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, 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, 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); }
/// <summary> /// Gets Prediction result /// </summary> /// <param name="target">Target for spell</param> /// <param name="width">Vector width</param> /// <param name="delay">Spell delay</param> /// <param name="vectorSpeed">Vector speed</param> /// <param name="range">Spell range</param> /// <param name="vectorLenght">Vector lenght</param> /// <returns>Prediction result as <see cref="Prediction.Vector.Result"/></returns> public static Result GetPrediction(Obj_AI_Hero target, float width, float delay, float vectorSpeed, float range, float vectorLenght) { return(GetPrediction(target, width, delay, vectorSpeed, range, vectorSpeed, target.GetWaypoints(), target.AvgMovChangeTime(), target.LastMovChangeTime(), target.AvgPathLenght(), ObjectManager.Player.ServerPosition.To2D())); }
/// <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, 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> /// Gets Prediction result /// </summary> /// <param name="target">Target</param> /// <returns>Prediction result as <see cref="Prediction.Result"/></returns> public static Prediction.Result GetSPrediction(this Spell s, Obj_AI_Hero target) { switch (s.Type) { case SkillshotType.SkillshotLine: return(LinePrediction.GetPrediction(target, s.Width, s.Delay, s.Speed, s.Range, s.Collision, target.GetWaypoints(), target.AvgMovChangeTime(), target.LastMovChangeTime(), target.AvgPathLenght(), s.From.To2D(), s.RangeCheckFrom.To2D())); case SkillshotType.SkillshotCircle: return(CirclePrediction.GetPrediction(target, s.Width, s.Delay, s.Speed, s.Range, s.Collision, target.GetWaypoints(), target.AvgMovChangeTime(), target.LastMovChangeTime(), target.AvgPathLenght(), s.From.To2D(), s.RangeCheckFrom.To2D())); case SkillshotType.SkillshotCone: return(ConePrediction.GetPrediction(target, s.Width, s.Delay, s.Speed, s.Range, s.Collision, target.GetWaypoints(), target.AvgMovChangeTime(), target.LastMovChangeTime(), target.AvgPathLenght(), s.From.To2D(), s.RangeCheckFrom.To2D())); } throw new NotSupportedException("Unknown skill shot type"); }
/// <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> /// Gets Prediction result /// </summary> /// <param name="target">Target</param> /// <returns>Prediction result as <see cref="Prediction.Result"/></returns> public static Prediction.Result GetArcSPrediction(this Spell s, Obj_AI_Hero target) { return(ArcPrediction.GetPrediction(target, s.Width, s.Delay, s.Speed, s.Range, s.Collision, target.GetWaypoints(), target.AvgMovChangeTime(), target.LastMovChangeTime(), target.AvgPathLenght(), s.From.To2D(), s.RangeCheckFrom.To2D())); }
/// <summary> /// Gets Prediction result /// </summary> /// <param name="target">Target</param> /// <returns>Prediction result as <see cref="Prediction.Result"/></returns> public static Prediction.Result GetArcSPrediction(this Spell s, Obj_AI_Hero target) { return ArcPrediction.GetPrediction(target, s.Width, s.Delay, s.Speed, s.Range, s.Collision, target.GetWaypoints(), target.AvgMovChangeTime(), target.LastMovChangeTime(), target.AvgPathLenght(), s.From.To2D(), s.RangeCheckFrom.To2D()); }
/// <summary> /// Gets Prediction result /// </summary> /// <param name="target">Target for spell</param> /// <param name="width">Spell width</param> /// <param name="delay">Spell delay</param> /// <param name="missileSpeed">Spell missile speed</param> /// <param name="range">Spell range</param> /// <param name="collisionable">Spell collisionable</param> /// <param name="type">Spell skillshot type</param> /// <param name="from">Spell casted position</param> /// <returns>Prediction result as <see cref="Prediction.Result"/></returns> public static Prediction.Result GetPrediction(Obj_AI_Hero target, float width, float delay, float missileSpeed, float range, bool collisionable) { return GetPrediction(target, width, delay, missileSpeed, range, collisionable, target.GetWaypoints(), target.AvgMovChangeTime(), target.LastMovChangeTime(), target.AvgPathLenght(), ObjectManager.Player.ServerPosition.To2D(), ObjectManager.Player.ServerPosition.To2D()); }
/// <summary> /// Gets Prediction result /// </summary> /// <param name="target">Target</param> /// <param name="vectorLenght">Vector Lenght</param> /// <returns>Prediction result as <see cref="Prediction.Vector.Result"/></returns> public static VectorPrediction.Result GetVectorSPrediction(this Spell s, Obj_AI_Hero target, float vectorLenght) { return VectorPrediction.GetPrediction(target, s.Width, s.Delay, s.Speed, s.Range, vectorLenght, target.GetWaypoints(), target.AvgMovChangeTime(), target.LastMovChangeTime(), target.AvgPathLenght(), s.RangeCheckFrom.To2D()); }
/// <summary> /// Gets Prediction result /// </summary> /// <param name="target">Target for spell</param> /// <param name="width">Spell width</param> /// <param name="delay">Spell delay</param> /// <param name="missileSpeed">Spell missile speed</param> /// <param name="range">Spell range</param> /// <param name="collisionable">Spell collisionable</param> /// <param name="type">Spell skillshot type</param> /// <param name="from">Spell casted position</param> /// <returns>Prediction result as <see cref="Prediction.Result"/></returns> public static Prediction.Result GetPrediction(Obj_AI_Hero target, float width, float delay, float missileSpeed, float range, bool collisionable) { return(GetPrediction(target, width, delay, missileSpeed, range, collisionable, target.GetWaypoints(), target.AvgMovChangeTime(), target.LastMovChangeTime(), target.AvgPathLenght(), ObjectManager.Player.ServerPosition.To2D(), ObjectManager.Player.ServerPosition.To2D())); }
/// <summary> /// Gets Prediction result /// </summary> /// <param name="target">Target</param> /// <returns>Prediction result as <see cref="Prediction.Result"/></returns> public static Prediction.Result GetSPrediction(this Spell s, Obj_AI_Hero target) { #region if common prediction selected if (ConfigMenu.SelectedPrediction.SelectedIndex == 1) { var pred = s.GetPrediction(target); var result = new Prediction.Result(new Prediction.Input(target, s), target, pred.CastPosition.To2D(), pred.UnitPosition.To2D(), pred.Hitchance, default(Collision.Result)); result.Lock(false); return(result); } #endregion switch (s.Type) { case SkillshotType.SkillshotLine: return(LinePrediction.GetPrediction(target, s.Width, s.Delay, s.Speed, s.Range, s.Collision, target.GetWaypoints(), target.AvgMovChangeTime(), target.LastMovChangeTime(), target.AvgPathLenght(), target.LastAngleDiff(), s.From.To2D(), s.RangeCheckFrom.To2D())); case SkillshotType.SkillshotCircle: return(CirclePrediction.GetPrediction(target, s.Width, s.Delay, s.Speed, s.Range, s.Collision, target.GetWaypoints(), target.AvgMovChangeTime(), target.LastMovChangeTime(), target.AvgPathLenght(), target.LastAngleDiff(), s.From.To2D(), s.RangeCheckFrom.To2D())); case SkillshotType.SkillshotCone: return(ConePrediction.GetPrediction(target, s.Width, s.Delay, s.Speed, s.Range, s.Collision, target.GetWaypoints(), target.AvgMovChangeTime(), target.LastMovChangeTime(), target.AvgPathLenght(), target.LastAngleDiff(), s.From.To2D(), s.RangeCheckFrom.To2D())); } throw new NotSupportedException("Unknown skill shot type"); }