Example #1
0
 /// <summary>
 /// Call this before <see cref="FindWithinArea"/> <para/>
 /// </summary>
 /// <param name="maxDistance">
 /// <see cref="TargetFindAOEType.Circle"/> - radius of circle <para/>
 /// <see cref="TargetFindAOEType.Cone"/> - height of cone <para/>
 /// <see cref="TargetFindAOEType.Box"/> - width of box / 2 (todo: set box length not just between user and target)
 /// </param>
 /// <param name="param"> param in degrees of cone (todo: probably use radians and forget converting at runtime) </param>
 public void SetAOEType(ValidTarget validTarget, TargetFindAOEType aoeType, TargetFindAOETarget aoeTarget, float maxDistance, float minDistance, float height, float aoeRotate, float coneAngle, float param = 0.0f)
 {
     this.validTarget    = validTarget;
     this.aoeType        = aoeType;
     this.maxDistance    = maxDistance;
     this.minDistance    = minDistance;
     this.param          = param;
     this.height         = height;
     this.aoeRotateAngle = aoeRotate;
     this.coneAngle      = coneAngle;
 }
Example #2
0
        /// <summary>
        /// Call this to prepare Box AOE
        /// </summary>
        /// <param name="validTarget"></param>
        /// <param name="aoeTarget"></param>
        /// <param name="length"></param>
        /// <param name="width"></param>
        public void SetAOEBox(ValidTarget validTarget, TargetFindAOETarget aoeTarget, float length, float width, float aoeRotateAngle)
        {
            this.validTarget    = validTarget;
            this.aoeType        = TargetFindAOEType.Box;
            this.aoeTarget      = aoeTarget;
            this.aoeRotateAngle = aoeRotateAngle;
            float x = owner.positionX - (float)Math.Cos(owner.rotation + (float)(Math.PI / 2)) * (length);
            float z = owner.positionZ + (float)Math.Sin(owner.rotation + (float)(Math.PI / 2)) * (length);

            this.maxDistance = length;
            this.width       = width;
        }
Example #3
0
 public void Reset()
 {
     this.findType          = TargetFindCharacterType.None;
     this.validTarget       = ValidTarget.Enemy;
     this.aoeType           = TargetFindAOEType.None;
     this.aoeTarget         = TargetFindAOETarget.Target;
     this.aoeTargetPosition = null;
     this.aoeTargetRotation = 0;
     this.maxDistance       = 0.0f;
     this.minDistance       = 0.0f;
     this.width             = 0.0f;
     this.height            = 0.0f;
     this.aoeRotateAngle    = 0.0f;
     this.coneAngle         = 0.0f;
     this.param             = 0.0f;
     this.targets           = new List <Character>();
 }
Example #4
0
        /// <summary>
        /// <para> Call SetAOEType before calling this </para>
        /// Find targets within area set by <see cref="SetAOEType"/>
        /// </summary>
        public void FindWithinArea(Character target, ValidTarget flags, TargetFindAOETarget aoeTarget)
        {
            targets.Clear();
            validTarget = flags;
            // are we creating aoe circles around target or self
            if (aoeTarget == TargetFindAOETarget.Self)
            {
                this.aoeTargetPosition = owner.GetPosAsVector3();
                this.aoeTargetRotation = owner.rotation + (float)(aoeRotateAngle * Math.PI);
            }
            else
            {
                this.aoeTargetPosition = target.GetPosAsVector3();
                this.aoeTargetRotation = target.rotation + (float)(aoeRotateAngle * Math.PI);
            }

            masterTarget = TryGetMasterTarget(target) ?? target;

            // todo: this is stupid
            bool withPet = (flags & ValidTarget.Ally) != 0 || masterTarget.allegiance != owner.allegiance;

            if (masterTarget != null && CanTarget(masterTarget))
            {
                targets.Add(masterTarget);
            }

            if (aoeType != TargetFindAOEType.None)
            {
                AddAllInRange(target, withPet);
            }

            //if (targets.Count > 8)
            //targets.RemoveRange(8, targets.Count - 8);

            //Curaga starts with lowest health players, so the targets are definitely sorted at least for some abilities
            //Other aoe abilities might be sorted by distance?
            //Protect is random
            targets.Sort(delegate(Character a, Character b) { return(a.GetHP().CompareTo(b.GetHP())); });
        }