int t; //Turn status public MainBoard(GameSetup game) { g = game; u = new Utilities(); harvest = false; harvestCounter = 0; harvestOver = false; t = 0; g.initializePlayers(this); s = new ScoreBoard(g); InitializeComponent(); }
static void Main() { int[] nPlayers; nPlayers = new int[1]; nPlayers[0] = 0; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new SetupForm(nPlayers)); GameSetup game = new GameSetup(nPlayers[0]); //Application.Run(new Form1(game)); //PlayerBoard board = new PlayerBoard(2, game); Application.Run(new MainBoard(game)); Application.Run(new ScoreBoard(game)); }
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 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 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(); } }
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); }