コード例 #1
0
        /// <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, AIHeroClient target)
        {
            #region if common prediction selected
            if (ConfigMenu.SelectedPrediction.Index == 1)
            {
                var pred   = s.GetPrediction(target);
                var result = new Prediction.Result(new Prediction.Input(target, s), target, pred.CastPosition.ToVector2(), pred.UnitPosition.ToVector2(), pred.Hitchance, default(Collision.Result));
                result.Lock(false);
                return(result);
            }
            #endregion

            switch (s.Type)
            {
            case SpellType.Line:
                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.ToVector2(), s.RangeCheckFrom.ToVector2()));

            case SpellType.Circle:
                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.ToVector2(), s.RangeCheckFrom.ToVector2()));

            case SpellType.Cone:
                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.ToVector2(), s.RangeCheckFrom.ToVector2()));
            }

            throw new NotSupportedException("Unknown skill shot type");
        }
コード例 #2
0
            /// <summary>
            /// Stasis calculations
            /// </summary>
            /// <param name="spell">The spell.</param>
            internal void Process(Spell spell)
            {
                float arrivalT = Prediction.GetArrivalTime(spell.From.Distance(this.Unit.PreviousPosition), spell.Delay, spell.Speed) * 1000f;

                if (Variables.TickCount - this.StartTick >= this.Duration - arrivalT)
                {
                    var pred = new Prediction.Result();
                    pred.Input        = new Prediction.Input(this.Unit, spell.Delay, spell.Speed, spell.Width, spell.Range, spell.Collision, spell.Type, spell.From, spell.RangeCheckFrom);
                    pred.Unit         = this.Unit;
                    pred.CastPosition = this.Unit.PreviousPosition.ToVector2();
                    pred.UnitPosition = pred.CastPosition;
                    pred.HitChance    = HitChance.VeryHigh;
                    pred.Lock(false);

                    var result = new Result();
                    result.Spell      = spell;
                    result.Prediction = pred;

                    if (OnGuaranteedHit != null && pred.HitChance != HitChance.Collision && pred.HitChance != HitChance.OutOfRange)
                    {
                        OnGuaranteedHit(MethodBase.GetCurrentMethod().DeclaringType, result);
                    }

                    this.Processed = true;
                }
            }