public void initializePlayers(MainBoard m) { players = new PlayerBoard[nPlayers]; for (int i = 0; i < nPlayers; i++) { players[i] = new PlayerBoard(i, this, m); } }
public void resourceTexts(int n, string s, MainBoard m) { switch (n + 1) { case 14: m.bRound14.Text = s; break; case 13: m.bRound13.Text = s; break; case 12: m.bRound12.Text = s; break; case 11: m.bRound11.Text = s; break; case 10: m.bRound10.Text = s; break; case 9: m.bRound9.Text = s; break; case 8: m.bRound8.Text = s; break; case 7: m.bRound7.Text = s; break; case 6: m.bRound6.Text = s; break; case 5: m.bRound5.Text = s; break; case 4: m.bRound4.Text = s; break; case 3: m.bRound3.Text = s; break; case 2: m.bRound2.Text = s; break; case 1: m.bRound1.Text = s; break; default: break; } }
public void enableCardText(MainBoard m, GameSetup g) { int card = g.roundCardOrder[g.round - 1] + 1; switch (g.round) { case 14: m.bRound14.Text = roundCardText(card); break; case 13: m.bRound13.Text = roundCardText(card); break; case 12: m.bRound12.Text = roundCardText(card); break; case 11: m.bRound11.Text = roundCardText(card); break; case 10: m.bRound10.Text = roundCardText(card); break; case 9: m.bRound9.Text = roundCardText(card); break; case 8: m.bRound8.Text = roundCardText(card); break; case 7: m.bRound7.Text = roundCardText(card); break; case 6: m.bRound6.Text = roundCardText(card); break; case 5: m.bRound5.Text = roundCardText(card); break; case 4: m.bRound4.Text = roundCardText(card); break; case 3: m.bRound3.Text = roundCardText(card); break; case 2: m.bRound2.Text = roundCardText(card); break; case 1: m.bRound1.Text = roundCardText(card); break; default: break; } }
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); }
public void disableRoundCards(MainBoard m, int cardNumber, int playerNumber) { switch (cardNumber) { case 0: m.bRound1.Enabled = false; m.bRound1.BackColor = playerColor(playerNumber); break; case 1: m.bRound2.Enabled = false; m.bRound2.BackColor = playerColor(playerNumber); break; case 2: m.bRound3.Enabled = false; m.bRound3.BackColor = playerColor(playerNumber); break; case 3: m.bRound4.Enabled = false; m.bRound4.BackColor = playerColor(playerNumber); break; case 4: m.bRound5.Enabled = false; m.bRound5.BackColor = playerColor(playerNumber); break; case 5: m.bRound6.Enabled = false; m.bRound6.BackColor = playerColor(playerNumber); break; case 6: m.bRound7.Enabled = false; m.bRound7.BackColor = playerColor(playerNumber); break; case 7: m.bRound8.Enabled = false; m.bRound8.BackColor = playerColor(playerNumber); break; case 8: m.bRound9.Enabled = false; m.bRound9.BackColor = playerColor(playerNumber); break; case 9: m.bRound10.Enabled = false; m.bRound10.BackColor = playerColor(playerNumber); break; case 10: m.bRound11.Enabled = false; m.bRound11.BackColor = playerColor(playerNumber); break; case 11: m.bRound12.Enabled = false; m.bRound12.BackColor = playerColor(playerNumber); break; case 12: m.bRound13.Enabled = false; m.bRound13.BackColor = playerColor(playerNumber); break; case 13: m.bRound14.Enabled = false; m.bRound14.BackColor = playerColor(playerNumber); break; } }
public void enableButtons(MainBoard m, GameSetup g) { switch (g.round) { case 14: m.bRound14.Enabled = true; m.bRound14.BackColor = System.Drawing.SystemColors.Control; goto case 13; case 13: m.bRound13.Enabled = true; m.bRound13.BackColor = System.Drawing.SystemColors.Control; goto case 12; case 12: m.bRound12.Enabled = true; m.bRound12.BackColor = System.Drawing.SystemColors.Control; goto case 11; case 11: m.bRound11.Enabled = true; m.bRound11.BackColor = System.Drawing.SystemColors.Control; goto case 10; case 10: m.bRound10.Enabled = true; m.bRound10.BackColor = System.Drawing.SystemColors.Control; goto case 9; case 9: m.bRound9.Enabled = true; m.bRound9.BackColor = System.Drawing.SystemColors.Control; goto case 8; case 8: m.bRound8.Enabled = true; m.bRound8.BackColor = System.Drawing.SystemColors.Control; goto case 7; case 7: m.bRound7.Enabled = true; m.bRound7.BackColor = System.Drawing.SystemColors.Control; goto case 6; case 6: m.bRound6.Enabled = true; m.bRound6.BackColor = System.Drawing.SystemColors.Control; goto case 5; case 5: m.bRound5.Enabled = true; m.bRound5.BackColor = System.Drawing.SystemColors.Control; goto case 4; case 4: m.bRound4.Enabled = true; m.bRound4.BackColor = System.Drawing.SystemColors.Control; goto case 3; case 3: m.bRound3.Enabled = true; m.bRound3.BackColor = System.Drawing.SystemColors.Control; goto case 2; case 2: m.bRound2.Enabled = true; m.bRound2.BackColor = System.Drawing.SystemColors.Control; goto case 1; case 1: m.bRound1.Enabled = true; m.bRound1.BackColor = System.Drawing.SystemColors.Control; break; default: break; } m.bRooms.Enabled = true; m.bRooms.BackColor = System.Drawing.SystemColors.Control; m.startingP.Enabled = true; m.startingP.Text = System.String.Format("Starting Player and {0} food", g.nStartingP); m.startingP.BackColor = System.Drawing.SystemColors.Control; m.tGrain.Enabled = true; m.tGrain.BackColor = System.Drawing.SystemColors.Control; m.plow.Enabled = true; m.plow.BackColor = System.Drawing.SystemColors.Control; m.bStable.Enabled = true; m.bStable.BackColor = System.Drawing.SystemColors.Control; m.laborer.Enabled = true; m.laborer.BackColor = System.Drawing.SystemColors.Control; m.tWood3.Enabled = true; m.tWood3.Text = System.String.Format("Take {0} wood (increase {1})", g.nTWood3, g.woodGain); m.tWood3.BackColor = System.Drawing.SystemColors.Control; m.tClay1.Enabled = true; m.tClay1.Text = System.String.Format("Take {0} clay (increase 1)", g.nTClay1); m.tClay1.BackColor = System.Drawing.SystemColors.Control; m.tReed1.Enabled = true; m.tReed1.Text = System.String.Format("Take {0} reed (increase 1)", g.nTReed1); m.tReed1.BackColor = System.Drawing.SystemColors.Control; m.fishing.Enabled = true; m.fishing.Text = System.String.Format("Take {0} food (increase 1)", g.nFishing); m.fishing.BackColor = System.Drawing.SystemColors.Control; if (g.enabledRoundCards[0]) { resourceTexts(Array.IndexOf(g.roundCardOrder, 0), System.String.Format("Take {0} Sheep (increase 1)", g.nSheep), m); } if (g.enabledRoundCards[4]) { resourceTexts(Array.IndexOf(g.roundCardOrder, 4), System.String.Format("Take {0} Stone (increase 1)", g.nStoneStage2), m); } if (g.enabledRoundCards[7]) { resourceTexts(Array.IndexOf(g.roundCardOrder, 7), System.String.Format("Take {0} Wild Boars (increase 1)", g.nBoars), m); } if (g.enabledRoundCards[9]) { resourceTexts(Array.IndexOf(g.roundCardOrder, 9), System.String.Format("Take {0} Stone (increase 1)", g.nStoneStage4), m); } if (g.enabledRoundCards[10]) { resourceTexts(Array.IndexOf(g.roundCardOrder, 10), System.String.Format("Take {0} Cattle (increase 1)", g.nCattle), m); } }
public PlayerBoard(int n, GameSetup g, MainBoard m) { playerNumber = n; maxMembers = 2; currentMembers = 0; newBorn = 0; baseScore = 0; nRooms = 2; houseType = 0; houseSort = 'w'; nFields = 0; nStables = 0; nFences = 0; resourceChosen = 0; farmSpaces = new char[15]; for (int i = 0; i < 15; i++) { farmSpaces[i] = 'e'; } farmSpaces[5] = 'w'; farmSpaces[10] = 'w'; resources = new int[10]; for (int i = 0; i < 9; i++) { resources[i] = 0; } if (playerNumber == g.startingPlayer) { resources[9] = 2; } else { resources[9] = 3; } boughtMajImprov = new bool[10]; for (int i = 0; i < 10; i++) { boughtMajImprov[i] = false; } builtFences = new bool[38]; for (int i = 0; i < 10; i++) { builtFences[i] = false; } preliminaryFences = new bool[38]; for (int i = 0; i < 10; i++) { preliminaryFences[i] = false; } pastureIndicator = new bool[15]; for (int i = 0; i < 15; i++) { pastureIndicator[i] = false; } pastureSizes = new int[6]; pastureSizes[0] = 1; for (int i = 1; i < 6; i++) { pastureSizes[i] = 0; } pastureMembers = new int[6][]; for (int i = 0; i < 6; i++) { pastureMembers[i] = new int[12]; for (int j = 0; j < 12; j++) { pastureMembers[i][j] = -1; } } pastureCounter = 1; pastureIndices = new int[6]; for (int i = 0; i < 6; i++) { pastureIndices[i] = 0; } pastureInhabitants = new int[6]; for (int i = 0; i < 6; i++) { pastureInhabitants[i] = 0; } pastureRace = new int[6]; for (int i = 0; i < 6; i++) { pastureRace[i] = -1; } livestockAllocated = new int[3]; for (int i = 0; i < 3; i++) { livestockAllocated[i] = 0; } stableUsed = new bool[15]; for (int i = 0; i < 15; i++) { stableUsed[i] = false; } board = new Form1(g, playerNumber, m); board.Text = System.String.Format("Player {0}", playerNumber + 1); }