示例#1
0
        /// <summary>
        ///     Spell extension for cast aoe spell with SPrediction
        /// </summary>
        /// <param name="minHit">Minimum aoe hits to cast</param>
        /// <returns></returns>
        public static bool SPredictionCastAoe(this Spell s, int minHit)
        {
            if (minHit < 2)
            {
                throw new InvalidOperationException("Minimum aoe hit count cannot be less than 2");
            }

            if (s.Collision)
            {
                throw new InvalidOperationException("Collisionable spell");
            }

            Prediction.AoeResult result;

            switch (s.Type)
            {
            case SkillshotType.SkillshotLine:
                result = LinePrediction.GetAoePrediction(s.Width, s.Delay, s.Speed, s.Range, s.From.LSTo2D(),
                                                         s.RangeCheckFrom.LSTo2D());
                break;

            case SkillshotType.SkillshotCircle:
                result = CirclePrediction.GetAoePrediction(s.Width, s.Delay, s.Speed, s.Range, s.From.LSTo2D(),
                                                           s.RangeCheckFrom.LSTo2D());
                break;

            case SkillshotType.SkillshotCone:
                result = ConePrediction.GetAoePrediction(s.Width, s.Delay, s.Speed, s.Range, s.From.LSTo2D(),
                                                         s.RangeCheckFrom.LSTo2D());
                break;

            default:
                throw new InvalidOperationException("Unknown spell type");
            }

            Drawings.s_DrawTick      = Utils.TickCount;
            Drawings.s_DrawPos       = result.CastPosition;
            Drawings.s_DrawHitChance = string.Format("Aoe Cast (Hits: {0})", result.HitCount);
            Drawings.s_DrawDirection = (result.CastPosition - s.From.LSTo2D()).LSNormalized().LSPerpendicular();
            Drawings.s_DrawWidth     = (int)s.Width;

            if (result.HitCount >= minHit)
            {
                return(s.Cast(result.CastPosition));
            }

            return(false);
        }
        /// <summary>
        /// Gets aoe prediction result
        /// </summary>
        /// <returns>Prediction result as <see cref="Prediction.Result"/></returns>
        public static Prediction.AoeResult GetAoeSPrediction(this Spell s)
        {
            if (s.Collision)
            {
                throw new InvalidOperationException("Collisionable spell");
            }

            switch (s.Type)
            {
            case SkillshotType.Line:
                return(LinePrediction.GetAoePrediction(s.Width, s.Delay, s.Speed, s.Range, s.From.ToVector2(), s.RangeCheckFrom.ToVector2()));

            case SkillshotType.Circle:
                return(CirclePrediction.GetAoePrediction(s.Width, s.Delay, s.Speed, s.Range, s.From.ToVector2(), s.RangeCheckFrom.ToVector2()));

            case SkillshotType.Cone:
                return(ConePrediction.GetAoePrediction(s.Width, s.Delay, s.Speed, s.Range, s.From.ToVector2(), s.RangeCheckFrom.ToVector2()));
            }

            throw new NotSupportedException("Unknown skill shot type");
        }
示例#3
0
        public PredictionOutput GetPrediction(EnsoulSharp.SDK.PredictionInput input)
        {
            if (input.Aoe && !input.Collision)
            {
                switch (input.Type)
                {
                case SpellType.Line:
                    return(LinePrediction.GetLineAoePrediction(input.Range, input.Delay, input.Speed, input.Range, input.From.ToVector2(), input.RangeCheckFrom.ToVector2()).ToSDKResult());

                case SpellType.Circle:
                    return(CirclePrediction.GetAoePrediction(input.Radius, input.Delay, input.Speed, input.Range, input.From.ToVector2(), input.RangeCheckFrom.ToVector2()).ToSDKResult());

                case SpellType.Cone:
                    return(ConePrediction.GetAoePrediction(input.Radius, input.Delay, input.Speed, input.Range, input.From.ToVector2(), input.RangeCheckFrom.ToVector2()).ToSDKResult());
                }

                return(new PredictionOutput());
            }

            var inp = new PredictionInput(input.Unit, input.Delay, input.Speed, input.Radius, input.Range, input.Collision, input.Type, input.From, input.RangeCheckFrom);

            return(this.GetPrediction(inp).ToSDKResult());
        }