Example #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.To2D(), s.RangeCheckFrom.To2D());
                break;

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

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

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

            Prediction.lastDrawTick      = Utils.TickCount;
            Prediction.lastDrawPos       = result.CastPosition;
            Prediction.lastDrawHitchance = String.Format("Aoe Cast (Hits: {0})", result.HitCount);
            Prediction.lastDrawDirection = (result.CastPosition - s.From.To2D()).Normalized().Perpendicular();
            Prediction.lastDrawWidth     = (int)s.Width;

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

            return(false);
        }
Example #2
0
        /// <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.SkillshotLine:
                return(LinePrediction.GetAoePrediction(s.Width, s.Delay, s.Speed, s.Range, s.From.To2D(), s.RangeCheckFrom.To2D()));

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

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

            throw new NotSupportedException("Unknown skill shot type");
        }