Ejemplo n.º 1
0
 public double GetStaminaMultiplier()
 {
     if (!EffectPoints.ContainsKey("Light") || !AbyssalEffectPoints.ContainsKey("Heavy"))
     {
         throw new KeyNotFoundException("No 'Heavy' and/or 'Light' effect in legendary effects.");
     }
     if (AbyssalEffectPoints["Heavy"] > 0)
     {
         return(2.0);
     }
     if (EffectPoints["Light"] > 0)
     {
         return(0.5);
     }
     return(1.0);
 }
Ejemplo n.º 2
0
        internal virtual string ChooseRandomEffect()
        {
            // Weighted choice of effect based on remaining open points.
            int  total     = EffectPoints.Sum(t => MaxEffectPoints[t.Key] - t.Value);
            int  roll      = Rand.Next(total);
            long weightSum = 0;

            for (int i = 0; i < EffectPoints.Count; i++)
            {
                weightSum += MaxEffectPoints.ElementAt(i).Value - EffectPoints.ElementAt(i).Value;
                if (roll < weightSum)
                {
                    return(EffectPoints.ElementAt(i).Key);
                }
            }
            throw new Exception($"Failure to choose random effect (roll {roll}, weight total {total})");
        }