Beispiel #1
0
        /**
         * <summary>
         * Create a dice result
         * </summary>
         */
        public DiceResult(DiceRoll diceRoll)
        {
            Roll = diceRoll;

            OriginalValue = randomizer.Next(1, ((int)diceRoll.face) + 1);
            IsCritical    = OriginalValue == (int)diceRoll.face;
            Value         = (OriginalValue + diceRoll.modifier) * diceRoll.criticalModifier;
        }
Beispiel #2
0
        /**
         * <summary>
         * A simple shortcut to GetResult. It creates the
         * dice roll instance itself and return a DiceResult
         * </summary>
         */
        public static DiceResult Roll(
            DiceFace face        = DiceFace.Six,
            int modifier         = 0,
            int criticalModifier = 1
            )
        {
            DiceRoll roll = new DiceRoll(face, modifier, criticalModifier);

            return(GetResult(roll));
        }
Beispiel #3
0
 /**
  * <summary>
  * Roll a dice and return a DiceResult
  * </summary>
  */
 public static DiceResult GetResult(DiceRoll diceRoll)
 {
     return(new DiceResult(diceRoll));
 }