public void CheckRequirements(List <Claim> features) { if (Requirements.Any(requierdClaim => !features.Any(featuredClaim => featuredClaim.Type == requierdClaim.Type && featuredClaim.Value == requierdClaim.Value) )) { throw new WrongRequirementException(); } var requierdSlots = Requirements.Where(c => c.Type == RpgClaimTypes.Slot); var availableSlots = features.Where(c => c.Type == RpgClaimTypes.Slot); if (requierdSlots.Any(rqs => availableSlots.Count(avs => avs.Value == rqs.Value) < requierdSlots.Count(rs => rs.Value == rqs.Value))) { throw new WrongRequirementException(); } }
public Dictionary <string, int> Execute(Equipment equipment, AffixManager affixManager) { if (equipment.Corrupted || Requirements.Any(requirement => !requirement(equipment))) { return(new Dictionary <string, int>()); } // Todo: Get modifiers for affixManager var currencySpent = CalculateCost(equipment, Name); foreach (var step in Steps) { step(equipment, affixManager, CurrencyModifiers); } return(currencySpent); }