private AbilityItemModel[] getRandomNPCAbilities(int numAbilities, int level) { List <AbilityItemModel> randomAbilitiesList = new List <AbilityItemModel>(); List <ItemModel> allAbilities = catalogModel.GetAllItemsOfType <AbilityItemModel>(); for (int i = 0; i < numAbilities; i++) { AbilityItemModel randomAbility = allAbilities[RandomGen.GetIntRange(0, allAbilities.Count - 1)] as AbilityItemModel; if (!randomAbilitiesList.Contains(randomAbility)) { randomAbilitiesList.Add(randomAbility); } } AbilityItemModel[] randomAbilitiesArray = new AbilityItemModel[randomAbilitiesList.Count]; for (int j = 0; j < randomAbilitiesArray.Length; j++) { AbilityItemModel clone = new AbilityItemModel(); clone.CopyFrom(randomAbilitiesList[j], false); clone.Level_ZeroBased = level; randomAbilitiesArray[j] = clone; } return(randomAbilitiesArray); }