Ejemplo n.º 1
0
        private void startTurnButton_Click(object sender, EventArgs e)
        {
            startTurnButton.Enabled = false;
            int totalMoves = 3;

            vcForms.Show();

            while (!vcForms.victoryCardsDone)
            {
                Application.DoEvents();
                Thread.Sleep(100);
            }
            vcForms.victoryCardsDone = false;

            ActionCardForm aCForm = new ActionCardForm(players[currentPlayer].age, players[currentPlayer].culture, actionCards, ref actionsToPerform);

            aCForm.Show();

            while (!aCForm.actionFormDone)
            {
                Application.DoEvents();
                Thread.Sleep(100);
            }
            aCForm.actionFormDone = false;
            DisplayHandForm dHandForm = new DisplayHandForm(actionsToPerform, ref players[currentPlayer], totalMoves, actionCards, cityMasterList, battleUnitMasterList, ref resourceMasterList, currentPlayer, ref players);

            dHandForm.Show();

            endTurnbutton.Enabled = true;

            while (!turnDone)
            {
                Application.DoEvents();
                Thread.Sleep(100);
                displayBoard(players[currentPlayer]);
            }
        }
Ejemplo n.º 2
0
        private void endTurnbutton_Click(object sender, EventArgs e)
        {
            turnDone = true;
            //spoilage for player
            spoilage();
            displayBoard(players[currentPlayer]);
            MessageBox.Show("Turn Over!");
            startTurnButton.Enabled = true;
            endTurnbutton.Enabled   = false;

            currentPlayer++;
            //AI 1 victory cube menu

            vcForms.Show();
            while (!vcForms.victoryCardsDone)
            {
                Application.DoEvents();
                Thread.Sleep(100);
            }
            vcForms.victoryCardsDone = false;
            //AI 1 turn
            Random          r         = new Random();
            DisplayHandForm dHandForm = new DisplayHandForm(actionsToPerform, ref players[currentPlayer], 4, actionCards, cityMasterList, battleUnitMasterList, ref resourceMasterList, currentPlayer, ref players);

            int firstAction = r.Next(0, 4);

            int secondAction = r.Next(0, 4);

            while (secondAction == firstAction)
            {
                secondAction = r.Next(0, 4);
            }
            int thirdAction = r.Next(0, 4);

            while (thirdAction == firstAction || thirdAction == secondAction)
            {
                thirdAction = r.Next(0, 4);
            }

            dHandForm.performAction(firstAction + 1);
            dHandForm.performAction(secondAction + 1);
            dHandForm.performAction(thirdAction + 1);

            //spoilage for AI 1
            spoilage();

            currentPlayer++;

            firstAction = r.Next(0, 4);

            secondAction = r.Next(0, 4);
            while (secondAction == firstAction)
            {
                secondAction = r.Next(0, 4);
            }
            thirdAction = r.Next(0, 4);
            while (thirdAction == firstAction || thirdAction == secondAction)
            {
                thirdAction = r.Next(0, 4);
            }
            //AI 2 victory cube menu
            vcForms.victoryCardsDone = false;
            vcForms.Show();
            while (!vcForms.victoryCardsDone)
            {
                Application.DoEvents();
                Thread.Sleep(100);
            }
            //AI2 turn
            dHandForm.performAction(firstAction + 1);
            dHandForm.performAction(secondAction + 1);
            dHandForm.performAction(thirdAction + 1);

            //spoilage for AI 2
            spoilage();

            currentPlayer            = (currentPlayer + 1) % 3;
            vcForms.victoryCardsDone = false;
        }