Example #1
0
        public void RollDice(Int16 nbrDice, Int16 dicetype, bool rerollduplicates)
        {
            //[0] contains the total value of all dice rolled.
            //other array position 1 to nbrdice contains the dice result

            Int16[] thishandresult = new Int16[nbrDice + 1];
            thishandresult[0] = 0;
            DiceBag dice = new DiceBag();


            for (Int16 i = 1; i <= nbrDice; i++)
            {
                dice.RollDie(dicetype);

                bool dicerollaccepted = true;

                //dicerollaccepted = ValidateRollAlreadyExists(thishandresult, dice.diceresult);

                if (dicerollaccepted)
                {
                    thishandresult[0] += dice.diceresult;
                    thishandresult[i]  = dice.diceresult;
                }
            }
            handresult = thishandresult;
        }
Example #2
0
        public Int16 ThrowDice(Int16 nbrDice, Int16 dicetype)
        {
            Int16[] thishandresult = new Int16[nbrDice + 1];
            thishandresult[0] = 0;

            for (Int16 i = 1; i <= nbrDice; i++)
            {
                DiceBag dice = new DiceBag();
                dice.RollDie(dicetype);

                thishandresult[0] += dice.diceresult;
                thishandresult[i]  = dice.diceresult;
            }

            return(thishandresult[0]);
        }
Example #3
0
        // [0] : Total for all dice
        // [i] : result of a die roll


        public void RollDice(Int16 nbrDice, Int16 dicetype)
        {
            //[0] contains the total value of all dice rolled.
            //other array position 1 to nbrdice contains the dice result

            Int16[] thishandresult = new Int16[nbrDice + 1];
            thishandresult[0] = 0;

            for (Int16 i = 1; i <= nbrDice; i++)
            {
                DiceBag dice = new DiceBag();
                dice.RollDie(dicetype);

                thishandresult[0] += dice.diceresult;
                thishandresult[i]  = dice.diceresult;
            }
            handresult = thishandresult;
        }
Example #4
0
        public Int16 ThrowDice(Int16 nbrDice, Int16 dicetype, Int16 ReRollIfHigherThan)
        {
            Int16[] thishandresult = new Int16[nbrDice + 1];

            DiceBag dice = new DiceBag();


            do
            {
                thishandresult[0] = 0;
                for (Int16 i = 1; i <= nbrDice; i++)
                {
                    dice.RollDie(dicetype);

                    thishandresult[0] += dice.diceresult;
                    thishandresult[i]  = dice.diceresult;
                }
            }while (thishandresult[0] >= ReRollIfHigherThan);

            return(thishandresult[0]);
        }