Engage() public static method

Switches the player to attack mode on the current unit
public static Engage ( IMemoryAPI fface ) : void
fface IMemoryAPI
return void
Beispiel #1
0
        /// <summary>
        ///     Use pulling moves if applicable to make the target
        ///     mob aggressive to us.
        /// </summary>
        public override void Run(IGameContext context)
        {
            // Has the user decided we should engage in battle.
            if (context.Target.Distance <= 25 && context.Config.IsEngageEnabled)
            {
                Player.Engage(context.API);
            }

            var actions = context.Config.BattleLists["Pull"].Actions.ToList();
            var usable  = actions.Where(x => ActionFilters.TargetedFilter(context.API, x, context.Target)).ToList();

            context.Memory.Executor.UseTargetedActions(context, usable, context.Target);
        }
Beispiel #2
0
        public override void Run(IGameContext context)
        {
            // Target mob if not currently targeted.
            Player.SetTarget(context.API, context.Target);

            // Has the user decided that we should approach targets?
            if (context.Config.IsApproachEnabled)
            {
                // Move to target if out of melee range.
                var path = context.NavMesh.FindPathBetween(context.API.Player.Position, context.Target.Position);

                // Has the user decided we should engage in battle.
                if (context.Target.Distance <= 25 && context.Config.IsEngageEnabled)
                {
                    Player.Engage(context.API);
                }

                if (context.Target.Distance <= Config.Instance.MeleeDistance)
                {
                    context.API.Navigator.FaceHeading(context.Target.Position, false);
                    context.API.Navigator.Reset();
                }
                else if (path.Count > 0)
                {
                    context.API.Navigator.DistanceTolerance = 3.0;

                    while (path.Count > 0 && path.Peek().Distance(context.API.Player.Position) <= context.API.Navigator.DistanceTolerance)
                    {
                        path.Dequeue();
                    }

                    if (path.Count > 0)
                    {
                        if (path.Peek().Distance(context.Target.Position) <= Config.Instance.MeleeDistance ||
                            context.API.Player.Position.Distance(context.Target.Position) <= Config.Instance.MeleeDistance)
                        {
                            context.API.Navigator.DistanceTolerance = Config.Instance.MeleeDistance;
                        }
                        context.API.Navigator.GotoNPC(context.Target.Id, path.Peek(), true);
                    }
                    else
                    {
                        context.API.Navigator.GotoNPC(context.Target.Id, context.Target.Position, false);
                    }
                }
            }
        }