private TreeEncounterAvailable GetAvailableModerate(int[] moderate) { if (ValidTreeIndex.Any(moderate.Contains)) { return(TreeEncounterAvailable.ValidTree); } if (InvalidTreeIndex.Any(moderate.Contains)) { return(TreeEncounterAvailable.InvalidTree); } return(TreeEncounterAvailable.Impossible); }
private TreeEncounterAvailable GetAvailableLow(int[] moderate) { if (ValidTreeIndex.Except(moderate).Any()) { return(TreeEncounterAvailable.ValidTree); } if (InvalidTreeIndex.Except(moderate).Any()) { return(TreeEncounterAvailable.InvalidTree); } return(TreeEncounterAvailable.Impossible); }
private void GenerateAreaTrainerEncounters() { // Check for every trainer pivot index if there are trees with low encounter and moderate encounter available in the area TrainerModerateEncounterTree = new TreeEncounterAvailable[10]; TrainerLowEncounterTree = new TreeEncounterAvailable[10]; for (int pivotindex = 0; pivotindex < 10; pivotindex++) { var TrainerModerateTrees = TrainerModerateTreeIndex[pivotindex]; var ModerateValid = ValidTreeIndex.Any(t => TrainerModerateTrees.Contains(t)); var ModerateInvalid = InvalidTreeIndex.Any(t => TrainerModerateTrees.Contains(t)); if (ModerateValid) { // There is a valid tree with an index for moderate encounters TrainerModerateEncounterTree[pivotindex] = TreeEncounterAvailable.ValidTree; } else if (ModerateInvalid) { // There is a tree with an index for moderate encounters but is invalid TrainerModerateEncounterTree[pivotindex] = TreeEncounterAvailable.InvalidTree; } else { // No trees for moderate encounters TrainerModerateEncounterTree[pivotindex] = TreeEncounterAvailable.Impossible; } var LowValid = ValidTreeIndex.Except(TrainerModerateTrees).Any(); var LowInvalid = InvalidTreeIndex.Except(TrainerModerateTrees).Any(); if (LowValid) { // There is a valid tree with an index for low encounters TrainerLowEncounterTree[pivotindex] = TreeEncounterAvailable.ValidTree; } else if (LowInvalid) { // There is a tree with an index for low encounters but is invalid TrainerLowEncounterTree[pivotindex] = TreeEncounterAvailable.InvalidTree; } else { // No trees for low encounters TrainerLowEncounterTree[pivotindex] = TreeEncounterAvailable.Impossible; } } }