示例#1
0
        public void showPastures(PlayerBoard thisPlayer, int n, string s)
        {
            Form1 board = thisPlayer.board;

            board.tileText[n].Visible   = true;
            board.tileText[n].Text      = s;
            board.tileText[n].BackColor = spaceColor(thisPlayer.farmSpaces[n]);
        }
示例#2
0
 public void initializePlayers(MainBoard m)
 {
     players = new PlayerBoard[nPlayers];
     for (int i = 0; i < nPlayers; i++)
     {
         players[i] = new PlayerBoard(i, this, m);
     }
 }
示例#3
0
        public bool checkFences(PlayerBoard thisPlayer)
        {
            int[] fences;
            fences = new int[38];
            int[] crossings;
            crossings = new int[24];

            for (int i = 0; i < 38; i++)
            {
                if (thisPlayer.preliminaryFences[i] || thisPlayer.builtFences[i])
                {
                    fences[i] = 1;
                }
                else
                {
                    fences[i] = 0;
                }
            }

            crossings[0]  = fences[0] + fences[20];
            crossings[1]  = fences[0] + fences[1] + fences[21];
            crossings[2]  = fences[1] + fences[2] + fences[22];
            crossings[3]  = fences[2] + fences[3] + fences[23];
            crossings[4]  = fences[3] + fences[4] + fences[24];
            crossings[5]  = fences[4] + fences[25];
            crossings[6]  = fences[5] + fences[20] + fences[26];
            crossings[7]  = fences[5] + fences[6] + fences[21] + fences[27];
            crossings[8]  = fences[6] + fences[7] + fences[22] + fences[28];
            crossings[9]  = fences[7] + fences[8] + fences[23] + fences[29];
            crossings[10] = fences[8] + fences[9] + fences[24] + fences[30];
            crossings[11] = fences[9] + fences[25] + fences[31];
            crossings[12] = fences[10] + fences[26] + fences[32];
            crossings[13] = fences[10] + fences[11] + fences[27] + fences[33];
            crossings[14] = fences[11] + fences[12] + fences[28] + fences[34];
            crossings[15] = fences[12] + fences[13] + fences[29] + fences[35];
            crossings[16] = fences[13] + fences[14] + fences[30] + fences[36];
            crossings[17] = fences[14] + fences[31] + fences[37];
            crossings[18] = fences[15] + fences[32];
            crossings[19] = fences[15] + fences[16] + fences[33];
            crossings[20] = fences[16] + fences[17] + fences[34];
            crossings[21] = fences[17] + fences[18] + fences[35];
            crossings[22] = fences[18] + fences[19] + fences[36];
            crossings[23] = fences[19] + fences[37];

            bool correct = true;

            for (int i = 0; i < 24; i++)
            {
                if (crossings[i] == 1)
                {
                    correct = false;
                }
            }
            return(correct);
        }
示例#4
0
 private void resetPastures(PlayerBoard thisPlayer)
 {
     if (thisPlayer.pastureCounter < 6)
     {
         thisPlayer.pastureIndices[thisPlayer.pastureCounter] = 0;
         for (int i = 0; i < 12; i++)
         {
             thisPlayer.pastureMembers[thisPlayer.pastureCounter][i] = -1;
         }
     }
 }
示例#5
0
 private bool checkSpace(int index, PlayerBoard thisPlayer)
 {
     if (index == -1)
     {
         return(false);
     }
     else
     {
         if (thisPlayer.pastureIndicator[index])
         {
             return(true);
         }                                                        //Already checked
         else
         {
             return(pastureChecker(index, thisPlayer, false));
         }
     }
 }
示例#6
0
        public void confirmFences(PlayerBoard thisPlayer)
        {
            bool hasStable;

            for (int i = 0; i < 38; i++)
            {
                if (thisPlayer.preliminaryFences[i])
                {
                    thisPlayer.builtFences[i]       = true;
                    thisPlayer.preliminaryFences[i] = false;
                    thisPlayer.board.built          = true;
                }
            }
            for (int i = 1; i < thisPlayer.pastureCounter; i++)
            {
                int stop = thisPlayer.pastureIndices[i];
                hasStable = false;
                for (int j = 0; j < stop; j++)
                {
                    int tile = thisPlayer.pastureMembers[i][j];
                    if (thisPlayer.farmSpaces[tile] == 'e')
                    {
                        thisPlayer.farmSpaces[tile] = 'p';
                    }
                    if (thisPlayer.farmSpaces[tile] == 'b')
                    {
                        thisPlayer.farmSpaces[tile] = 'h';
                    }
                    if (thisPlayer.farmSpaces[tile] == 'h')
                    {
                        hasStable = true;
                    }
                }
                thisPlayer.pastureSizes[i] = stop * 2;
                if (hasStable)
                {
                    thisPlayer.pastureSizes[i] *= 2;
                }
            }
        }
示例#7
0
        public bool hasNeighbour(PlayerBoard thisPlayer, int tile, char thisType)
        {
            int  left    = neighbourMatrix[tile][0];
            int  top     = neighbourMatrix[tile][1];
            int  right   = neighbourMatrix[tile][2];
            int  bot     = neighbourMatrix[tile][3];
            bool correct = false;

            if (left >= 0)
            {
                if (thisPlayer.farmSpaces[left] == thisType)
                {
                    return(true);
                }
            }
            if (top >= 0)
            {
                if (thisPlayer.farmSpaces[top] == thisType)
                {
                    return(true);
                }
            }
            if (right >= 0)
            {
                if (thisPlayer.farmSpaces[right] == thisType)
                {
                    return(true);
                }
            }
            if (bot >= 0)
            {
                if (thisPlayer.farmSpaces[bot] == thisType)
                {
                    return(true);
                }
            }
            return(correct);
        }
示例#8
0
        public bool actions(GameSetup g, int n, MainBoard m)
        {
            bool        success    = false;
            char        newSort    = 'c';
            int         newType    = 1;
            PlayerBoard thisPlayer = g.players[g.currentPlayer];

            switch (n)
            {
            case 0:     //Sheep
                if (thisPlayer.board.doneIndicator == 0)
                {
                    thisPlayer.resources[6]     += g.nSheep;
                    thisPlayer.board.nSheep.Text = thisPlayer.resources[6].ToString();
                    g.nSheep = 0;
                    m.Hide();
                    thisPlayer.board.Show();
                    thisPlayer.board.Activate();
                    thisPlayer.board.calledBy           = 7;
                    thisPlayer.board.doneButton.Visible = true;
                    thisPlayer.board.livestockAllocation();
                }

                if (thisPlayer.board.doneIndicator > 0)
                {
                    m.Show();
                    thisPlayer.board.doneButton.Visible  = false;
                    thisPlayer.board.radioBoars.Visible  = false;
                    thisPlayer.board.radioCattle.Visible = false;
                    thisPlayer.board.radioSheep.Visible  = false;
                    thisPlayer.board.laborerR.Visible    = false;
                    thisPlayer.board.infoBox.Text        = "";
                    thisPlayer.board.hideMajImprovs();
                    if (thisPlayer.board.doneIndicator == 2)
                    {
                        disableRoundCards(m, Array.IndexOf(g.roundCardOrder, 0), g.currentPlayer);
                        thisPlayer.board.doneIndicator = 0;
                        m.endTurn();
                    }
                    thisPlayer.board.doneIndicator = 0;
                }
                break;

            case 1:     //Fence
                if (thisPlayer.board.doneIndicator == 0)
                {
                    m.Hide();
                    thisPlayer.board.Show();
                    thisPlayer.board.Activate();
                    thisPlayer.board.calledBy           = 6;
                    thisPlayer.board.infoBox.Text       = "Click the fences you want and then done";
                    thisPlayer.board.doneButton.Visible = true;
                    thisPlayer.board.showFences();
                }

                if (thisPlayer.board.doneIndicator > 0)
                {
                    m.Show();
                    thisPlayer.board.doneButton.Visible  = false;
                    thisPlayer.board.radioBoars.Visible  = false;
                    thisPlayer.board.radioCattle.Visible = false;
                    thisPlayer.board.radioSheep.Visible  = false;
                    thisPlayer.board.infoBox.Text        = "";
                    if (thisPlayer.board.doneIndicator == 2)
                    {
                        disableRoundCards(m, Array.IndexOf(g.roundCardOrder, 1), g.currentPlayer);
                        thisPlayer.board.doneIndicator = 0;
                        m.endTurn();
                    }
                    thisPlayer.board.doneIndicator = 0;
                }
                break;

            case 2:     //Major Improv

                if (thisPlayer.board.doneIndicator == 0)
                {
                    m.Hide();
                    thisPlayer.board.Show();
                    thisPlayer.board.Activate();
                    thisPlayer.board.calledBy           = 4;
                    thisPlayer.board.infoBox.Text       = "Build the improvement you want or click done";
                    thisPlayer.board.doneButton.Visible = true;
                    this.enableMajImprovButtons(thisPlayer.board, g.availableMajImprov, false);
                }

                if (thisPlayer.board.doneIndicator > 0)
                {
                    m.Show();
                    thisPlayer.board.doneButton.Visible = false;
                    thisPlayer.board.infoBox.Text       = "";
                    thisPlayer.board.hideMajImprovs();
                    if (thisPlayer.board.doneIndicator == 2)
                    {
                        disableRoundCards(m, Array.IndexOf(g.roundCardOrder, 2), g.currentPlayer);
                        thisPlayer.board.doneIndicator = 0;
                        m.endTurn();
                    }
                    thisPlayer.board.doneIndicator = 0;
                }
                break;

            case 3:     //Sow/Bake
                if (thisPlayer.board.doneIndicator == 0)
                {
                    m.Hide();
                    thisPlayer.board.Show();
                    thisPlayer.board.Activate();
                    thisPlayer.board.calledBy           = 5;
                    thisPlayer.board.infoBox.Text       = "Choose field and crop to sow or improvement to bake";
                    thisPlayer.board.doneButton.Visible = true;
                    enableMajImprovButtons(thisPlayer.board, thisPlayer.boughtMajImprov, true);
                }

                if (thisPlayer.board.doneIndicator > 0)
                {
                    m.Show();
                    thisPlayer.board.doneButton.Visible = false;
                    thisPlayer.board.infoBox.Text       = "";
                    thisPlayer.board.hideMajImprovs();
                    if (thisPlayer.board.doneIndicator == 2)
                    {
                        disableRoundCards(m, Array.IndexOf(g.roundCardOrder, 3), g.currentPlayer);
                        thisPlayer.board.doneIndicator = 0;
                        m.endTurn();
                    }
                    thisPlayer.board.doneIndicator = 0;
                }
                break;

            case 4:     //Stone
                g.players[g.currentPlayer].resources[2] += g.nStoneStage2;
                g.nStoneStage2 = 0;
                success        = true;
                break;

            case 5:     //Family growth
                if (thisPlayer.maxMembers < g.players[g.currentPlayer].nRooms && thisPlayer.maxMembers < 5)
                {
                    thisPlayer.maxMembers++;
                    success = true;
                    thisPlayer.newBorn++;
                }
                break;

            case 6:     //Renovation + Improv
                if (thisPlayer.houseSort == 'w')
                {
                    newType = 1; newSort = 'c';
                }
                if (thisPlayer.houseSort == 'c')
                {
                    newType = 2; newSort = 's';
                }

                if (thisPlayer.board.doneIndicator == 0 && thisPlayer.houseSort != 's')
                {
                    if (thisPlayer.resources[newType] >= thisPlayer.nRooms && thisPlayer.resources[3] >= 1)
                    {
                        thisPlayer.resources[newType] -= thisPlayer.nRooms;
                        thisPlayer.resources[3]       -= 1;
                        for (int i = 0; i < 15; i++)
                        {
                            if (thisPlayer.farmSpaces[i] == thisPlayer.houseSort)
                            {
                                thisPlayer.farmSpaces[i] = newSort;
                            }
                        }
                        thisPlayer.houseSort = newSort;
                        thisPlayer.houseType = newType;
                        m.Hide();
                        thisPlayer.board.updateBoard();
                        thisPlayer.board.Show();
                        thisPlayer.board.Activate();
                        thisPlayer.board.calledBy           = 10;
                        thisPlayer.board.infoBox.Text       = "Build the improvement you want or click done";
                        thisPlayer.board.doneButton.Visible = true;
                        this.enableMajImprovButtons(thisPlayer.board, g.availableMajImprov, false);
                    }
                }

                if (thisPlayer.board.doneIndicator > 0)
                {
                    m.Show();
                    thisPlayer.board.doneButton.Visible = false;
                    thisPlayer.board.infoBox.Text       = "";
                    thisPlayer.board.hideMajImprovs();
                    if (thisPlayer.board.doneIndicator == 2)
                    {
                        disableRoundCards(m, Array.IndexOf(g.roundCardOrder, 6), g.currentPlayer);
                        thisPlayer.board.doneIndicator = 0;
                        m.endTurn();
                    }
                    thisPlayer.board.doneIndicator = 0;
                }
                break;

            case 7:     //Boars

                if (thisPlayer.board.doneIndicator == 0)
                {
                    thisPlayer.resources[7] += g.nBoars;
                    g.nBoars = 0;
                    thisPlayer.board.nBoars.Text = thisPlayer.resources[7].ToString();
                    m.Hide();
                    thisPlayer.board.Show();
                    thisPlayer.board.Activate();
                    thisPlayer.board.calledBy           = 8;
                    thisPlayer.board.doneButton.Visible = true;
                    thisPlayer.board.livestockAllocation();
                }

                if (thisPlayer.board.doneIndicator > 0)
                {
                    m.Show();
                    thisPlayer.board.doneButton.Visible  = false;
                    thisPlayer.board.radioBoars.Visible  = false;
                    thisPlayer.board.radioCattle.Visible = false;
                    thisPlayer.board.radioSheep.Visible  = false;
                    thisPlayer.board.laborerR.Visible    = false;
                    thisPlayer.board.infoBox.Text        = "";
                    thisPlayer.board.hideMajImprovs();
                    if (thisPlayer.board.doneIndicator == 2)
                    {
                        disableRoundCards(m, Array.IndexOf(g.roundCardOrder, 7), g.currentPlayer);
                        thisPlayer.board.doneIndicator = 0;
                        m.endTurn();
                    }
                    thisPlayer.board.doneIndicator = 0;
                }
                break;

            case 8:     //Veggie
                g.players[g.currentPlayer].resources[5] += 1;
                success = true;
                break;

            case 9:     //Stone
                g.players[g.currentPlayer].resources[2] += g.nStoneStage4;
                g.nStoneStage4 = 0;
                success        = true;
                break;

            case 10:     //Cattle

                if (thisPlayer.board.doneIndicator == 0)
                {
                    thisPlayer.resources[8] += g.nCattle;
                    g.nCattle = 0;
                    thisPlayer.board.nCattle.Text = thisPlayer.resources[8].ToString();
                    m.Hide();
                    thisPlayer.board.Show();
                    thisPlayer.board.Activate();
                    thisPlayer.board.calledBy           = 9;
                    thisPlayer.board.doneButton.Visible = true;
                    thisPlayer.board.livestockAllocation();
                }

                if (thisPlayer.board.doneIndicator > 0)
                {
                    m.Show();
                    thisPlayer.board.doneButton.Visible  = false;
                    thisPlayer.board.radioBoars.Visible  = false;
                    thisPlayer.board.radioCattle.Visible = false;
                    thisPlayer.board.radioSheep.Visible  = false;
                    thisPlayer.board.laborerR.Visible    = false;
                    thisPlayer.board.infoBox.Text        = "";
                    thisPlayer.board.hideMajImprovs();
                    if (thisPlayer.board.doneIndicator == 2)
                    {
                        disableRoundCards(m, Array.IndexOf(g.roundCardOrder, 10), g.currentPlayer);
                        thisPlayer.board.doneIndicator = 0;
                        m.endTurn();
                    }
                    thisPlayer.board.doneIndicator = 0;
                }
                break;

            case 11:     //Plow/Sow
                if (thisPlayer.board.doneIndicator == 0)
                {
                    m.Hide();
                    thisPlayer.board.Show();
                    thisPlayer.board.Activate();
                    thisPlayer.board.calledBy           = 11;
                    thisPlayer.board.infoBox.Text       = "Click an empty space to plow a/o 'Done'";
                    thisPlayer.board.doneButton.Visible = true;
                }

                if (thisPlayer.board.doneIndicator > 0)
                {
                    m.Show();
                    thisPlayer.board.infoBox.Text       = "";
                    thisPlayer.board.doneButton.Visible = false; if (thisPlayer.board.doneIndicator == 2)
                    {
                        disableRoundCards(m, Array.IndexOf(g.roundCardOrder, 11), g.currentPlayer);
                        thisPlayer.board.doneIndicator = 0;
                        m.endTurn();
                    }
                    thisPlayer.board.doneIndicator = 0;
                }
                break;

            case 12:     //Family crowded
                if (thisPlayer.maxMembers < 5)
                {
                    g.players[g.currentPlayer].maxMembers++;
                    success = true;
                    thisPlayer.newBorn++;
                }
                break;

            case 13:     //Renovation + Fence
                if (thisPlayer.houseSort == 'w')
                {
                    newType = 1; newSort = 'c';
                }
                if (thisPlayer.houseSort == 'c')
                {
                    newType = 2; newSort = 's';
                }

                if (thisPlayer.board.doneIndicator == 0 && thisPlayer.houseSort != 's')
                {
                    if (thisPlayer.resources[newType] >= thisPlayer.nRooms && thisPlayer.resources[3] >= 1)
                    {
                        thisPlayer.resources[newType] -= thisPlayer.nRooms;
                        thisPlayer.resources[3]       -= 1;
                        for (int i = 0; i < 15; i++)
                        {
                            if (thisPlayer.farmSpaces[i] == thisPlayer.houseSort)
                            {
                                thisPlayer.farmSpaces[i] = newSort;
                            }
                        }
                        thisPlayer.houseSort = newSort;
                        thisPlayer.houseType = newType;
                        m.Hide();
                        thisPlayer.board.Show();
                        thisPlayer.board.Activate();
                        thisPlayer.board.calledBy           = 12;
                        thisPlayer.board.infoBox.Text       = "Click the fences you want and then done";
                        thisPlayer.board.doneButton.Visible = true;
                        thisPlayer.board.showFences();
                    }
                }

                if (thisPlayer.board.doneIndicator > 0)
                {
                    m.Show();
                    thisPlayer.board.doneButton.Visible  = false;
                    thisPlayer.board.radioBoars.Visible  = false;
                    thisPlayer.board.radioCattle.Visible = false;
                    thisPlayer.board.radioSheep.Visible  = false;
                    thisPlayer.board.infoBox.Text        = "";
                    if (thisPlayer.board.doneIndicator == 2)
                    {
                        disableRoundCards(m, Array.IndexOf(g.roundCardOrder, 13), g.currentPlayer);
                        thisPlayer.board.doneIndicator = 0;
                        m.endTurn();
                    }
                    thisPlayer.board.doneIndicator = 0;
                }
                break;

            default:
                break;
            }
            return(success);
        }
示例#9
0
        private bool pastureChecker(int index, PlayerBoard thisPlayer, bool originalCall)
        {
            bool correct   = true;
            bool isPasture = true;

            int[][] members  = thisPlayer.pastureMembers;
            int[]   indices  = thisPlayer.pastureIndices;
            int     pCounter = thisPlayer.pastureCounter;

            thisPlayer.pastureIndicator[index] = true;

            bool leftFence  = (thisPlayer.preliminaryFences[neighbourMatrix[index][4]] || thisPlayer.builtFences[neighbourMatrix[index][4]]);
            bool topFence   = (thisPlayer.preliminaryFences[neighbourMatrix[index][5]] || thisPlayer.builtFences[neighbourMatrix[index][5]]);
            bool rightFence = (thisPlayer.preliminaryFences[neighbourMatrix[index][6]] || thisPlayer.builtFences[neighbourMatrix[index][6]]);
            bool botFence   = (thisPlayer.preliminaryFences[neighbourMatrix[index][7]] || thisPlayer.builtFences[neighbourMatrix[index][7]]);

            if (leftFence && topFence && originalCall)
            {
                members[pCounter][0] = index;
                indices[pCounter]    = 1;
                if (!rightFence)
                {
                    if (!checkSpace(neighbourMatrix[index][2], thisPlayer))
                    {
                        isPasture = false;
                    }
                }
                if (!botFence)
                {
                    if (!checkSpace(neighbourMatrix[index][3], thisPlayer))
                    {
                        isPasture = false;
                    }
                }

                if (isPasture)
                {
                    bool hasStable = false;
                    for (int i = 0; i < indices[pCounter]; i++)
                    {
                        if (thisPlayer.farmSpaces[members[pCounter][i]] == 'b' || thisPlayer.farmSpaces[members[pCounter][i]] == 'h')
                        {
                            if (hasStable)
                            {
                                return(false);
                            }                                //Check for double stables
                            else
                            {
                                hasStable = true;
                            }
                        }
                        else if (thisPlayer.farmSpaces[members[pCounter][i]] == 'p' || thisPlayer.farmSpaces[members[pCounter][i]] == 'e')
                        {
                        }
                        else
                        {
                            return(false);
                        }
                    }
                    thisPlayer.pastureCounter++;
                }
            }

            if (!originalCall)
            {
                members[pCounter][indices[pCounter]] = index;
                indices[pCounter]++;
                if (!leftFence)
                {
                    if (!checkSpace(neighbourMatrix[index][0], thisPlayer))
                    {
                        return(false);
                    }
                }
                if (!topFence)
                {
                    if (!checkSpace(neighbourMatrix[index][1], thisPlayer))
                    {
                        return(false);
                    }
                }
                if (!rightFence)
                {
                    if (!checkSpace(neighbourMatrix[index][2], thisPlayer))
                    {
                        return(false);
                    }
                }
                if (!botFence)
                {
                    if (!checkSpace(neighbourMatrix[index][3], thisPlayer))
                    {
                        return(false);
                    }
                }
            }

            return(correct);
        }
示例#10
0
        public void scoring(GameSetup g)
        {
            for (int i = 0; i < g.nPlayers; i++)
            {
                PlayerBoard player   = g.players[i];
                int         crops    = 0;
                int         animals  = 0;
                int         fields   = 0;
                int         pastures = 0;
                int         rooms    = 0;
                int         empty    = 0;
                int         stables  = 0;
                int         cards    = 0;
                int         people   = 0;
                int         score    = 0;

                int grain = player.resources[4];
                int veg   = player.resources[5];

                for (int j = 0; j < 15; j++)
                {
                    if (player.farmSpaces[j] == 'e')
                    {
                        empty--;
                    }
                    if (player.farmSpaces[j] == 'c')
                    {
                        rooms++;
                    }
                    if (player.farmSpaces[j] == 's')
                    {
                        rooms += 2;
                    }
                    if (player.farmSpaces[j] == 'h')
                    {
                        stables++;
                    }
                    if (player.farmSpaces[j] == 'u')
                    {
                        veg++;
                    }
                    if (player.farmSpaces[j] == 'v')
                    {
                        veg += 2;
                    }
                    if (player.farmSpaces[j] == 'x')
                    {
                        grain++;
                    }
                    if (player.farmSpaces[j] == 'y')
                    {
                        grain += 2;
                    }
                    if (player.farmSpaces[j] == 'z')
                    {
                        grain += 3;
                    }
                }

                if (player.nFields >= 5)
                {
                    fields = 4;
                }
                else if (player.nFields <= 1)
                {
                    fields--;
                }
                else
                {
                    fields = player.nFields - 1;
                }

                if (player.pastureCounter >= 5)
                {
                    pastures = 4;
                }
                else if (player.pastureCounter == 1)
                {
                    pastures--;
                }                                                    //PastureConter starts at 1
                else
                {
                    pastures = player.pastureCounter - 1;
                }

                if (grain >= 8)
                {
                    crops += 4;
                }
                else if (grain == 0)
                {
                    crops--;
                }
                else if (grain == 1)
                {
                    crops++;
                }
                else
                {
                    crops += grain / 2;
                }

                if (veg >= 4)
                {
                    crops += 4;
                }
                else if (veg == 0)
                {
                    crops--;
                }
                else
                {
                    crops += veg;
                }

                if (player.resources[6] >= 8)
                {
                    animals += 4;
                }                                               //Sheep
                else if (player.resources[6] == 0)
                {
                    animals--;
                }
                else if (player.resources[6] == 1)
                {
                    animals++;
                }
                else
                {
                    animals += player.resources[6] / 2;
                }

                if (player.resources[7] >= 7)
                {
                    animals += 4;
                }                                               //Boars
                else if (player.resources[7] == 0)
                {
                    animals--;
                }
                else
                {
                    animals += (player.resources[7] + 1) / 2;
                }

                if (player.resources[8] >= 6)
                {
                    animals += 4;
                }                                               //Cattle
                else if (player.resources[8] == 0)
                {
                    animals--;
                }
                else
                {
                    animals += player.resources[8] / 2 + 1;
                }

                people += player.maxMembers * 3;
                cards  += player.baseScore; //Base score from cards

                if (player.boughtMajImprov[7])
                {
                    if (player.resources[0] >= 7)
                    {
                        cards += 3;
                    }
                    else if (player.resources[0] >= 5)
                    {
                        cards += 2;
                    }
                    else if (player.resources[0] >= 3)
                    {
                        cards += 1;
                    }
                }

                if (player.boughtMajImprov[8])
                {
                    if (player.resources[1] >= 7)
                    {
                        cards += 3;
                    }
                    else if (player.resources[1] >= 5)
                    {
                        cards += 2;
                    }
                    else if (player.resources[1] >= 3)
                    {
                        cards += 1;
                    }
                }

                if (player.boughtMajImprov[9])
                {
                    if (player.resources[2] >= 5)
                    {
                        cards += 3;
                    }
                    else if (player.resources[2] >= 4)
                    {
                        cards += 2;
                    }
                    else if (player.resources[2] >= 2)
                    {
                        cards += 1;
                    }
                }

                score = crops + fields + animals + pastures + empty + stables + people + cards + rooms;

                this.boxes[i].box.Text      = crops.ToString();
                this.boxes[5 + i].box.Text  = animals.ToString();
                this.boxes[10 + i].box.Text = pastures.ToString();
                this.boxes[15 + i].box.Text = fields.ToString();
                this.boxes[20 + i].box.Text = empty.ToString();
                this.boxes[25 + i].box.Text = rooms.ToString();
                this.boxes[30 + i].box.Text = cards.ToString();
                this.boxes[35 + i].box.Text = stables.ToString();
                this.boxes[40 + i].box.Text = people.ToString();
                this.boxes[45 + i].box.Text = score.ToString();
            }
        }
示例#11
0
        private void harvesting()
        {
            PlayerBoard thisPlayer = g.players[g.currentPlayer];

            if (thisPlayer.board.doneIndicator == 0)
            {
                thisPlayer.board.Show();
                thisPlayer.board.Activate();
                thisPlayer.board.calledBy           = 13;
                thisPlayer.board.infoBox.Text       = "Produce food for harvest";
                thisPlayer.board.doneButton.Visible = true;
                u.enableMajImprovButtons(thisPlayer.board, thisPlayer.boughtMajImprov, false);
                thisPlayer.board.well.Visible            = false;
                thisPlayer.board.clayOven.Visible        = false;
                thisPlayer.board.stoneOven.Visible       = false;
                thisPlayer.board.radioSheep.Visible      = true;
                thisPlayer.board.radioBoars.Visible      = true;
                thisPlayer.board.radioCattle.Visible     = true;
                thisPlayer.board.radioGrain.Visible      = true;
                thisPlayer.board.radioVegetables.Visible = true;
                thisPlayer.board.spareButton.Visible     = true;
                thisPlayer.board.spareButton.Text        = "Eat raw";
            }

            if (thisPlayer.board.doneIndicator == 1)
            {
                thisPlayer.resources[9] -= thisPlayer.maxMembers * g.foodConsumption - thisPlayer.newBorn * (g.foodConsumption - 1); //eating
                if (thisPlayer.resources[9] < 0)
                {
                    int scoreLoss = thisPlayer.resources[9] * 3;
                    thisPlayer.baseScore         += scoreLoss;
                    thisPlayer.resources[9]       = 0;
                    thisPlayer.board.infoBox.Text = System.String.Format("You just lost {0} points", scoreLoss * (-1));
                }
                thisPlayer.board.updateBoard();

                for (int i = 6; i < 9; i++) //Breeding
                {
                    if (thisPlayer.resources[i] >= 2)
                    {
                        thisPlayer.resources[i]++;
                    }
                }

                thisPlayer.board.radioGrain.Visible      = false;
                thisPlayer.board.radioVegetables.Visible = false;
                thisPlayer.board.spareButton.Visible     = false;
                thisPlayer.board.laborerR.Visible        = true;
                thisPlayer.board.laborerR.Text           = "Release";
                thisPlayer.board.infoBox.Text            = "Allocate animals";
                thisPlayer.board.calledBy = 14;
                thisPlayer.board.livestockAllocation();
                thisPlayer.board.hideMajImprovs();
                thisPlayer.board.allocating = true;
            }

            if (thisPlayer.board.doneIndicator == 2)
            {
                thisPlayer.board.doneButton.Visible  = false;
                thisPlayer.board.radioBoars.Visible  = false;
                thisPlayer.board.radioCattle.Visible = false;
                thisPlayer.board.radioSheep.Visible  = false;
                thisPlayer.board.laborerR.Visible    = false;
                thisPlayer.board.allocating          = false;
                thisPlayer.board.doneIndicator       = 0;
                thisPlayer.board.infoBox.Text        = "";
                harvestCounter++;
                if (harvestCounter >= g.nPlayers)
                {
                    harvestOver = true;
                }

                thisPlayer.board.doneIndicator = 0;
                g.currentPlayer++;
                g.currentPlayer = g.currentPlayer % g.nPlayers;
                endTurn();
            }
        }