Ejemplo n.º 1
0
        /// <summary>
        /// Spell extension for cast aoe vector spell with SPrediction
        /// </summary>
        /// <param name="vectorLenght">Vector lenght</param>
        /// <param name="minHit">Minimum aoe hits to cast</param>
        /// <returns></returns>
        public static bool SPredictionCastAoeVector(this Spell s, float vectorLenght, 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");
            }

            VectorPrediction.AoeResult result = VectorPrediction.GetAoePrediction(s.Width, s.Delay, s.Speed, s.Range, vectorLenght, s.RangeCheckFrom.To2D());

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

            if (result.HitCount >= minHit)
            {
                return(s.Cast(result.CastSourcePosition, result.CastTargetPosition));
            }

            return(false);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Gets aoe vector prediction
        /// </summary>
        /// <param name="vectorLenght">Vector lenght</param>
        /// <returns>Prediction result as <see cref="VectorPrediction.AoeResult"/></returns>
        public static VectorPrediction.AoeResult GetAoeVectorSPrediction(this Spell s, float vectorLenght)
        {
            if (s.Collision)
            {
                throw new InvalidOperationException("Collisionable spell");
            }

            return(VectorPrediction.GetAoePrediction(s.Width, s.Delay, s.Speed, s.Range, vectorLenght, s.RangeCheckFrom.To2D()));
        }