protected void RegisterActionFilter(string action, string controller, IActionFilter filter) { ActionFilters.Add(new DynamicActionFilter() { Action = action, Controller = controller, Filter = filter }); }
public override bool Check(IGameContext context) { if (new RestState().Check(context)) { return(false); } if (!context.API.Player.Status.Equals(Status.Standing)) { return(false); } var trusts = context.Config.BattleLists["Trusts"].Actions .Where(t => t.IsEnabled) .Where(t => ActionFilters.BuffingFilter(context.API, t)) .ToList(); var maxTrustPartySize = context.Config.TrustPartySize; foreach (var trust in trusts) { if (TrustNeedsDismissal(context, trust) || !TrustInParty(context, trust) && PartyHasSpace(context) && !MaxTrustsReached(context, maxTrustPartySize)) { return(true); } } return(false); }
/// <summary> /// Adds the action filter. /// </summary> /// <param name="filter">The filter.</param> protected virtual void AddActionFilter(IActionFilter filter) { if (!ActionFilters.Contains(filter)) { ActionFilters.Add(filter); } }
/// <summary> /// Use pulling moves if applicable to make the target /// mob aggressive to us. /// </summary> public override void Run(IGameContext context) { 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(usable, context.Target); }
/// <summary> /// Use pulling moves if applicable to make the target /// mob aggressive to us. /// </summary> public override void Run() { var actions = Config.BattleLists["Pull"].Actions.ToList(); var usable = actions.Where(x => ActionFilters.TargetedFilter(EliteApi, x, Target)).ToList(); Executor.UseTargetedActions(usable, Target); }
public override bool CheckComponent() { if (new RestState(fface).CheckComponent()) { return(false); } // Target dead or null. if (!UnitFilters.MobFilter(fface, Target)) { return(false); } // We should approach mobs that have aggroed or have been pulled. if (Target.Status.Equals(Status.Fighting)) { return(true); } // Get usable abilities. var usable = Config.Instance.BattleLists["Pull"].Actions .Where(x => ActionFilters.BuffingFilter(fface, x)); // Approach when there are no pulling moves available. if (!usable.Any()) { return(true); } // Approach mobs if their distance is close. return(Target.Distance < 8); }
public override void RunComponent() { // Check engaged // FIXED: no longer return on not engage but don't execute // these moves instead. Fixes the bot not attacking things // from move than 30 yalms problem. if (fface.Player.Status.Equals(Status.Fighting)) { // Grab the first weaponskill or null. var weaponskill = Config.Instance.BattleLists["Weaponskill"] .Actions.FirstOrDefault(); // See if they the user set a weaponskill. if (weaponskill == null) { return; } // Perform the weaponskill if it is valid. if (ActionFilters.TargetedFilter(fface, weaponskill, Target)) { Executor.UseTargetedAction(weaponskill, Target); } } }
public void VerifyActionUsable() { var memoryAPI = FindMemoryApi(); var result = ActionFilters.BuffingFilter(memoryAPI, _battleAbility); Assert.True(result); }
/// <summary> /// Use pulling moves if applicable to make the target /// mob aggressive to us. /// </summary> public override void RunComponent() { var actions = Config.Instance.BattleLists["Pull"].Actions.ToList(); var usable = actions.Where(x => ActionFilters.TargetedFilter(fface, x, Target)).ToList(); Executor.UseTargetedActions(usable, Target); }
public override bool Check() { if (new RestState(Memory).Check()) { return(false); } if (!EliteApi.Player.Status.Equals(Status.Standing)) { return(false); } var trusts = Config.Instance.BattleLists["Trusts"].Actions .Where(t => t.IsEnabled) .Where(t => ActionFilters.BuffingFilter(EliteApi, t)) .ToList(); var maxTrustPartySize = Config.Instance.TrustPartySize; foreach (var trust in trusts) { if (TrustNeedsDismissal(trust) || !TrustInParty(trust) && PartyHasSpace() && !MaxTrustsReached(maxTrustPartySize)) { return(true); } } return(false); }
private void AddFilter(Filter filter) { if (filter == null) { throw new ArgumentNullException(nameof(filter)); } var instance = filter.Instance; if (instance is IAuthenticationFilter authentication) { AuthenticationFilters.Add(new FilterInfo <IAuthenticationFilter> { Filter = authentication, Scope = filter.Scope, Order = filter.Order }); } if (instance is IAuthorizationFilter authorization) { AuthorizationFilters.Add(new FilterInfo <IAuthorizationFilter> { Filter = authorization, Scope = filter.Scope, Order = filter.Order }); } if (instance is IActionFilter action) { ActionFilters.Add(new FilterInfo <IActionFilter> { Filter = action, Scope = filter.Scope, Order = filter.Order }); } if (instance is IResultFilter result) { ResultFilters.Add(new FilterInfo <IResultFilter> { Filter = result, Scope = filter.Scope, Order = filter.Order }); } if (instance is IExceptionFilter exception) { ExceptionFilters.Add(new FilterInfo <IExceptionFilter> { Filter = exception, Scope = filter.Scope, Order = filter.Order }); } }
public void VerifyActionUsable() { GlobalFactory.BuildUnitService = x => new TestUnitService(); var memory = FindMemoryApi(); var result = ActionFilters.BuffingFilter(memory, _battleAbility); Assert.True(result); }
public override void Run() { var usable = Config.Instance.BattleLists["Start"] .Actions.Where(x => ActionFilters.BuffingFilter(fface, x)); // Execute moves at target. Executor.UseBuffingActions(usable); }
public override void Run(IGameContext context) { var usable = context.Config.BattleLists["Start"] .Actions.Where(x => ActionFilters.BuffingFilter(context.API, x)); // Execute moves at target. context.Memory.Executor.UseBuffingActions(usable); }
public override bool Check(IGameContext context) { if (new RestState().Check(context)) { return(false); } return(context.Config.BattleLists["Healing"].Actions .Any(x => ActionFilters.BuffingFilter(context.API, x))); }
public void VerifyActionNotUsable() { var memoryAPI = FindMemoryApi(); var result = ActionFilters.ValidateBuffingAction(memoryAPI, _battleAbility, new List <IUnit> { new FakeUnit() }).ToList(); Assert.NotEmpty(result); }
public override bool Check() { if (new RestState(Memory).Check()) { return(false); } return(Config.Instance.BattleLists["Healing"].Actions .Any(x => ActionFilters.BuffingFilter(EliteApi, x))); }
public override void RunComponent() { // Cast only one action to prevent blocking curing. var action = Config.Instance.BattleLists["Battle"].Actions .FirstOrDefault(x => ActionFilters.TargetedFilter(fface, x, Target)); if (action != null) { _executor.UseTargetedAction(action, Target); } }
/// <summary> /// Used For Queueing Actions Inside AllyActionQueueController /// </summary> /// <param name="actionToPerform">From IGBPI_Action Struct.</param> /// <param name="canPerformAction">From IGBPI_Action Struct. Only Needed For Testing Action Condition Inside AllyTacticsController Script. Use (_ally) => true If No Additional Condition is Needed</param> /// <param name="actionFilter">From IGBPI_Action Struct.</param> /// <param name="stopPerformingTask">Optional Action That Will Stop The Execution Of A Task. Use (_ally) => {} if Stopping Isn't Needed</param> public RTSActionItem( System.Action <AllyMember, AllyAIController, AllyMember> actionToPerform, System.Func <AllyMember, AllyAIController, AllyMember, bool> canPerformAction, ActionFilters actionFilter, System.Action <AllyMember, AllyAIController, AllyMember> stopPerformingTask ) { this.actionToPerform = actionToPerform; this.canPerformAction = canPerformAction; this.actionFilter = actionFilter; this.stopPerformingTask = stopPerformingTask; }
public override void Run() { // Cast only one action to prevent blocking curing. var action = Config.Instance.BattleLists["Battle"].Actions .FirstOrDefault(x => ActionFilters.TargetedFilter(EliteApi, x, Target)); if (action == null) { return; } Executor.UseTargetedActions(new[] { action }, Target); }
/// <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); }
public override void Run(IGameContext context) { // Execute moves. var usable = context.Config.BattleLists["End"].Actions .Where(x => ActionFilters.BuffingFilter(context.API, x)); context.Memory.Executor.UseBuffingActions(usable, context.API.Player.Position); // Reset all usage data to begin a new battle. foreach (var action in context.Config.BattleLists.Actions) { action.Usages = 0; } }
public override void Run() { // Execute moves. var usable = Config.Instance.BattleLists["End"].Actions .Where(x => ActionFilters.BuffingFilter(fface, x)); _executor.UseBuffingActions(usable); // Reset all usage data to begin a new battle. foreach (var action in Config.Instance.BattleLists.Actions) { action.Usages = 0; } }
public ActionFilters NavPreviousAction() { var _filters = Enum.GetValues(typeof(ActionFilters)); if ((int)actionFilter > 0) { actionFilter--; } else { actionFilter = (ActionFilters)_filters.Length - 1; } return(actionFilter); }
public ActionFilters NavForwardAction() { var _filters = Enum.GetValues(typeof(ActionFilters)); if ((int)actionFilter < _filters.Length - 1) { actionFilter++; } else { actionFilter = (ActionFilters)0; } return(actionFilter); }
public override void Run(IGameContext context) { ShouldRecycleBattleStateCheck(context); // Cast only one action to prevent blocking curing. var action = context.Config.BattleLists["Battle"].Actions .FirstOrDefault(x => ActionFilters.TargetedFilter(context.API, x, context.Target)); if (action == null) { return; } context.Memory.Executor.UseTargetedActions(new[] { action }, context.Target); }
public override void Run() { // Get the list of healing abilities that can be used. var healingMoves = Config.Instance.BattleLists["Healing"].Actions .Where(x => ActionFilters.BuffingFilter(EliteApi, x)) .ToList(); if (healingMoves.Count <= 0) { return; } var healingMove = healingMoves.First(); Executor.UseBuffingActions(new[] { healingMove }); }
public override bool Check() { if (new RestState(fface).Check()) { return(false); } if (!Config.Instance.BattleLists["Healing"].Actions .Any(x => ActionFilters.BuffingFilter(fface, x))) { return(false); } return(true); }
public override void Run(IGameContext context) { // Get the list of healing abilities that can be used. var healingMoves = context.Config.BattleLists["Healing"].Actions .Where(x => ActionFilters.BuffingFilter(context.API, x)) .ToList(); if (healingMoves.Count <= 0) { return; } var healingMove = healingMoves.First(); context.Memory.Executor.UseBuffingActions(new[] { healingMove }, context.API.Player.Position); }
/// <summary> /// Use pulling moves if applicable to make the target /// mob aggressive to us. /// </summary> public override void RunComponent() { // Do not pull if we've done so already. if (CombatBaseState.IsFighting) { return; } // Only pull if we have moves. if (Config.Instance.BattleLists["Pull"] .Actions.Any(x => x.IsEnabled)) { var usable = Config.Instance.BattleLists["Pull"] .Actions.Where(x => ActionFilters.TargetedFilter(fface, x, Target)); Executor.UseTargetedActions(usable, Target); } }