Ejemplo n.º 1
0
 /// <summary>
 /// Applies the modifier to a GameValue
 /// </summary>
 /// <param name="GameValue">GameValue to modify</param>
 public void Modify(GameValue gameValue)
 {
     if (set)
     {
         gameValue.setValue(setTo);
     }
     else
     {
         if (random != null)
         {
             // applies the change with AddSubtract and RangeChange
             gameValue.Add((decimal)(change * Math.Pow(random.NextDouble(), rangeChange) * Math.Sign(random.NextDouble() - .5 + addSubtract)));
             // applies the multiplier with MultiplyDivide and RangeMultiplier
             gameValue.Multiply((decimal)Math.Pow((multiplier - 1) * Math.Pow(random.NextDouble(), rangeMultiplier) + 1, Math.Sign(random.NextDouble() - .5 + multiplyDivide)));
             if (random.NextDouble() < resetChance)
             {
                 gameValue.Reset();
             }
         }
         else
         {
             // applies the change
             gameValue.Add((decimal)(change * addSubtract));
             //applies the multiplier
             gameValue.Multiply((decimal)Math.Pow(multiplier, multiplyDivide));
         }
     }
 }
Ejemplo n.º 2
0
 public void Modify(GameValue gameValue)
 {
     gameValue.Add((decimal)(change * Math.Pow(random.NextDouble(), rangeChange) * Math.Sign(random.NextDouble() - .5 + addSubtract)));
     gameValue.Multiply((decimal)Math.Pow((multiplier - 1) * Math.Pow(random.NextDouble(), rangeMultiplier) + 1, Math.Sign(random.NextDouble() - .5 + multiplyDivide)));
     if (random.NextDouble() < resetChance)
     {
         gameValue.Reset();
     }
 }