public async Task <GoapGoal?> GetAction() { if (playerReader.HealthPercent > 1 && blacklist.IsTargetBlacklisted()) { logger.LogWarning("Target is blacklisted"); await input.TapClearTarget(); UpdateWorldState(); } var goal = new HashSet <KeyValuePair <GoapKey, GoapPreCondition> >(); //Plan Queue <GoapGoal> plan = planner.Plan(AvailableGoals, WorldState, goal); if (plan != null && plan.Count > 0) { CurrentGoal = plan.Peek(); } else { logger.LogInformation($"Target Health: {playerReader.TargetHealth}, max {playerReader.TargetMaxHealth}, dead {playerReader.PlayerBitValues.TargetIsDead}"); if (this.classConfiguration.Mode != Mode.AttendedGrind) { await input.TapNearestTarget(); } } return(CurrentGoal); }
public async Task <GoapGoal?> GetAction() { if (playerReader.HealthPercent > 1 && blacklist.IsTargetBlacklisted()) { logger.LogWarning($"{GetType().Name}: Target is blacklisted - StopAttack & ClearTarget"); await input.TapStopAttack(""); await input.TapClearTarget(""); UpdateWorldState(); } var goal = new HashSet <KeyValuePair <GoapKey, GoapPreCondition> >(); //Plan Queue <GoapGoal> plan = planner.Plan(AvailableGoals, WorldState, goal); if (plan != null && plan.Count > 0) { if (CurrentGoal == plan.Peek() && !CurrentGoal.Repeatable) { logger.LogInformation($"Plan= {CurrentGoal.GetType().Name} is not Repeatable!"); CurrentGoal = null; } else { CurrentGoal = plan.Peek(); } } else { if (CurrentGoal != null && !CurrentGoal.Repeatable) { logger.LogInformation($"Plan= {CurrentGoal.GetType().Name} is not Repeatable!"); CurrentGoal = null; await stopMoving.Stop(); } } return(CurrentGoal); }