Esempio n. 1
0
        //private const int MINIMIZE = 6;
        //private const int RESTORE = 9;

        static void Main(string[] args)
        {
            Console.SetWindowSize(Console.LargestWindowWidth, Console.LargestWindowHeight);
            ShowWindow(ThisConsole, MAXIMIZE);
            Dicer.GetDice();
            GameCreationMenus.StartMenu();
        }
Esempio n. 2
0
        public static void BattleRollOptions(Attack attack)
        {
            var dice = Dicer.GetDice();

            if (attack.AttackDiceCount == 1)
            {
                attack.AttackDice1 = dice.RandomRoll();
            }
            else if (attack.AttackDiceCount == 2)
            {
                attack.AttackDice1 = dice.RandomRoll();
                attack.AttackDice2 = dice.RandomRoll();
            }
            else if (attack.AttackDiceCount == 3)
            {
                attack.AttackDice1 = dice.RandomRoll();
                attack.AttackDice2 = dice.RandomRoll();
                attack.AttackDice3 = dice.RandomRoll();
            }

            if (attack.DefendDiceCount == 1)
            {
                attack.DefendDice1 = dice.RandomRoll();
            }
            else if (attack.DefendDiceCount == 2)
            {
                attack.DefendDice1 = dice.RandomRoll();
                attack.DefendDice2 = dice.RandomRoll();
            }
        }
Esempio n. 3
0
 public static Dicer GetDice()
 {
     if (_dicer == null)
     {
         _dicer = new Dicer(new Random());
     }
     return(_dicer);
 }
Esempio n. 4
0
        public static Player HighestRoll(List <Player> rollers)
        {
            int    highest     = 0;
            int    winnerCount = 0;
            Player winner      = null;
            var    success     = false;

            while (success == false)
            {
                foreach (var player in rollers)
                {
                    var roll = Dicer.GetDice().RandomRoll();
                    if (roll > highest)
                    {
                        highest     = roll;
                        winner      = player;
                        winnerCount = 1;
                    }
                    else if (roll == highest)
                    {
                        winnerCount++;
                    }
                }

                if (winnerCount == 1)
                {
                    success = true;
                }
                else
                {
                    winnerCount = 0;
                    highest     = 0;
                }
            }
            return(winner);
        }