public void ApplyAffordanceEffect([NotNull][ItemNotNull] List <CalcDesire> satisfactionvalues, bool randomEffect,
                                   [NotNull] string affordance)
 {
     while (_lastAffordances.Count > 10)
     {
         _lastAffordances.RemoveAt(0);
     }
     _lastAffordances.Add(affordance);
     foreach (var satisfactionvalue in satisfactionvalues)
     {
         if (Desires.ContainsKey(satisfactionvalue.DesireID))
         {
             Desires[satisfactionvalue.DesireID].Value += satisfactionvalue.Value;
             if (Desires[satisfactionvalue.DesireID].Value > 1)
             {
                 Desires[satisfactionvalue.DesireID].Value = 1;
             }
         }
     }
     if (randomEffect)
     {
         var usedDesires = new Dictionary <CalcDesire, bool>();
         foreach (var satisfactionvalue in satisfactionvalues)
         {
             usedDesires.Add(satisfactionvalue, true);
         }
         var desiresArray = new CalcDesire[Desires.Count];
         Desires.Values.CopyTo(desiresArray, 0);
         var affectedCount = _calcRepo.Rnd.Next(Desires.Count - usedDesires.Count + 1);
         for (var i = 0; i < affectedCount; i++)
         {
             CalcDesire d         = null;
             var        loopcount = 0;
             while (d == null)
             {
                 var selectedkey = _calcRepo.Rnd.Next(Desires.Count);
                 d = desiresArray[selectedkey];
                 loopcount++;
                 if (usedDesires.ContainsKey(d))
                 {
                     d = null;
                 }
                 if (loopcount > 500)
                 {
                     throw new LPGException("Random result failed after 500 tries...");
                 }
             }
             d.Value += (decimal)_calcRepo.Rnd.NextDouble();
             if (d.Value > 1)
             {
                 d.Value = 1;
             }
         }
     }
 }