示例#1
0
        /// <summary> Initializes a new instance of the <see cref="DiceChainLink" /> class. </summary>
        /// <param name="operation">The dice operation which will be used with a dice chain node.</param>
        /// <param name="node">This dice chain node.</param>
        /// <param name="previous">The link to previous node in the dice chain.</param>
        internal DiceChainLink(DiceOperation operation, SeveralDice node, DiceChainLink previous)
        {
            Contract.Requires(operation != DiceOperation.None);
            Contract.Requires(node != null);

            Operation = operation;
            Node      = node;
            Previous  = previous;
        }
示例#2
0
        /// <summary> Initializes a new instance of the <see cref="DiceChainLink" /> class. </summary>
        /// <param name="operation">The dice operation which will be used with a dice chain node.</param>
        /// <param name="node">This dice chain node.</param>
        /// <param name="previous">The link to previous node in the dice chain.</param>
        internal DiceChainLink(DiceOperation operation, SeveralDice node, DiceChainLink previous)
        {
            Contract.Requires(operation != DiceOperation.None);
            Contract.Requires(node != null);

            Operation = operation;
            Node = node;
            Previous = previous;
        }
示例#3
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;
        }
示例#4
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);
        }