public List <Card> GetListInRightOrder(IEnumerable <Card> list, HaremType type, string tag) { switch (type) { case HaremType.Health: return(list.OrderByDescending(x => x.GetHealthWithPenalty()).ToList()); case HaremType.Affection: return(list.OrderByDescending(x => x.Affection).ToList()); case HaremType.Attack: return(list.OrderByDescending(x => x.GetAttackWithBonus()).ToList()); case HaremType.Defence: return(list.OrderByDescending(x => x.GetDefenceWithBonus()).ToList()); case HaremType.Cage: return(list.Where(x => x.InCage).ToList()); case HaremType.Tag: return(list.Where(x => x.Tags != null).Where(x => x.Tags.Contains(tag, StringComparison.CurrentCultureIgnoreCase)).ToList()); case HaremType.NoTag: return(list.Where(x => x.Tags == null || (x.Tags != null && !x.Tags.Contains(tag, StringComparison.CurrentCultureIgnoreCase))).ToList()); default: case HaremType.Rarity: return(list.OrderBy(x => x.Rarity).ToList()); } }
public List <Card> GetListInRightOrder(IEnumerable <Card> list, HaremType type, string tag) { switch (type) { case HaremType.Health: return(list.OrderByDescending(x => x.GetHealthWithPenalty()).ToList()); case HaremType.Affection: return(list.OrderByDescending(x => x.Affection).ToList()); case HaremType.Attack: return(list.OrderByDescending(x => x.GetAttackWithBonus()).ToList()); case HaremType.Defence: return(list.OrderByDescending(x => x.GetDefenceWithBonus()).ToList()); case HaremType.Unique: return(list.Where(x => x.Unique).ToList()); case HaremType.Cage: return(list.Where(x => x.InCage).ToList()); case HaremType.Blocked: return(list.Where(x => !x.IsTradable).ToList()); case HaremType.Broken: return(list.Where(x => x.IsBroken()).ToList()); case HaremType.Tag: { var nList = new List <Card>(); var tagList = tag.Split(" ").ToList(); foreach (var t in tagList) { if (t.Length < 1) { continue; } nList = list.Where(x => x.TagList.Any(c => c.Name.Equals(t, StringComparison.CurrentCultureIgnoreCase))).ToList(); } return(nList); } case HaremType.NoTag: { var nList = new List <Card>(); var tagList = tag.Split(" ").ToList(); foreach (var t in tagList) { if (t.Length < 1) { continue; } nList = list.Where(x => !x.TagList.Any(c => c.Name.Equals(t, StringComparison.CurrentCultureIgnoreCase))).ToList(); } return(nList); } case HaremType.Picture: return(list.Where(x => x.HasImage()).ToList()); case HaremType.NoPicture: return(list.Where(x => x.Image == null).ToList()); case HaremType.CustomPicture: return(list.Where(x => x.CustomImage != null).ToList()); default: case HaremType.Rarity: return(list.OrderBy(x => x.Rarity).ToList()); } }