예제 #1
0
        /// <summary>
        /// Creates a move to melee range behavior.  Tests .IsWithinMeleeRange so we know whether WoW thinks
        /// we are within range, which is more important than our distance calc.  For players keep moving
        /// until 2 yds away so we stick to them in pvp
        /// </summary>
        /// <param name="stopInRange"></param>
        /// <returns></returns>
        public static Composite CreateMoveToMeleeBehavior(bool stopInRange)
        {
#if OLD_MELEE_MOVE
            return(new Decorator(
                       ret => !MovementManager.IsMovementDisabled,
                       new PrioritySelector(
                           new Decorator(
                               ret => stopInRange && InMoveToMeleeStopRange(StyxWoW.Me.CurrentTarget),
                               new PrioritySelector(
                                   CreateEnsureMovementStoppedWithinMelee(),
                                   new Action(ret => RunStatus.Success)
                                   )
                               ),
                           new Decorator(
                               ret => StyxWoW.Me.CurrentTarget != null && StyxWoW.Me.CurrentTarget.IsValid,
                               new Sequence(
                                   new Action(ret => Logger.WriteDebug(Color.White, "MoveToMelee: towards {0} @ {1:F1} yds", StyxWoW.Me.CurrentTarget.SafeName(), StyxWoW.Me.CurrentTarget.Distance)),
                                   new Action(ret => Navigator.MoveTo(StyxWoW.Me.CurrentTarget.Location)),
                                   new Action(ret => StopMoving.InMeleeRangeOfUnit(StyxWoW.Me.CurrentTarget, and => InMoveToMeleeStopRange(StyxWoW.Me.CurrentTarget))),
                                   new ActionAlwaysFail()
                                   )
                               )
                           )
                       ));
#else
            return(new Decorator(
                       ret => StyxWoW.Me.CurrentTarget != null && !StyxWoW.Me.CurrentTarget.IsWithinMeleeRange,
                       new Sequence(
                           new Action(ret =>
            {
                MoveResult res = Navigator.MoveTo(StyxWoW.Me.CurrentTarget.Location);
                Logging.WriteDiagnostic("MoveToMelee({0}): towards {1} @ {2:F1} yds", res.ToString(), StyxWoW.Me.CurrentTarget.SafeName(), StyxWoW.Me.CurrentTarget.Distance);
                //Logger.WriteDebug(Color.White, "MoveToMelee({0}): towards {1} @ {2:F1} yds", res.ToString(), StyxWoW.Me.CurrentTarget.SafeName(), StyxWoW.Me.CurrentTarget.Distance);
            }),
                           new Action(ret => StopMoving.InMeleeRangeOfUnit(StyxWoW.Me.CurrentTarget)),
                           new ActionAlwaysFail()
                           )
                       ));
#endif
        }
예제 #2
0
        private static bool CheckMoving()
        {
            if (Target.Distance >= 3 && Target.IsMoving && !Me.MovementInfo.MovingForward)
            {
                //WoWMovement.Move(WoWMovement.MovementDirection.Forward);
                Navigator.MoveTo(StyxWoW.Me.CurrentTarget.Location);
                return(true);
            }


            if (Target.Distance < 3 && Target.IsMoving && Me.MovementInfo.MovingForward)
            {
                //WoWMovement.MoveStop(WoWMovement.MovementDirection.Forward);
                StopMoving.InMeleeRangeOfUnit(StyxWoW.Me.CurrentTarget);
                return(true);
            }

            if ((Me.MovementInfo.MovingStrafeRight || Me.MovementInfo.MovingStrafeLeft) && Me.CurrentTarget.Distance > 5)
            {
                StopMovement(false, false, true, true);
            }

            return(false);
        }