Beispiel #1
0
        /// <summary> Appends a new chain node to the dice chain using a specified operation.</summary>
        /// <remarks> Append(DiceOperation.Minus, Dice.D10) is equivalent to Minus(Dice.D10). </remarks>
        /// <param name="linkOperation">The operation used to operate on dice rolls between chain nodes.</param>
        /// <param name="linkContent">Actual content of the chain node.</param>
        /// <returns>Dice chain with new node appended.</returns>
        public DiceChain Append(DiceOperation linkOperation, SeveralDice linkContent)
        {
            Contract.Requires(linkOperation != DiceOperation.None);
            Contract.Requires(linkContent != null);

            LastLink = new DiceChainLink(linkOperation, linkContent, LastLink);
            return(this);
        }
Beispiel #2
0
        /// <summary> Initializes a new instance of the <see cref="DiceChain"/> class. </summary>
        /// <param name="node">The first node for the dice chain.</param>
        public DiceChain(SeveralDice node)
        {
            Contract.Requires(node != null);

            LastLink = new DiceChainLink(DiceOperation.Plus, node);
        }