public TurnResults mortgageUnmortgage(Boolean[] mortgageProperties, TurnResults turnResults, int player) { int mortgageValue = 0; //FLIP ALL PROPERTIES THAT ARE TRUE for (int index28 = 0; index28 < mortgageProperties.Length; index28++) { if (mortgageProperties[index28]) { if (propertyOwners.propertyMortgaged(index28)) { mortgageValue = getMortgagePropertyValue(index28) * -1; turnResults.addPlayerCash(player, mortgageValue); } else if (!propertyOwners.propertyMortgaged(index28)) { mortgageValue = getMortgagePropertyValue(index28); turnResults.addPlayerCash(player, mortgageValue); } //END IF } //END IF } //END FOR propertyOwners.mortgageUnmortgage(mortgageProperties); return(turnResults); }
public TurnResults addHouses(int player, int[] houses, TurnResults turnResults) { int costOfHouses = 0; //SQUARE IS FROM PROPERTIES THAT BUY HOUSES 22 //ADD HOUSES TO TOTAL //ONLY NEGITIVE NUMBERS AND ZEROS IN HOUSES propertyOwners.addHouses(player, houses); for (int index22 = 0; index22 < houses.Length; index22++) { costOfHouses = propertyInfo.getHousePropertyHouseCost(index22); costOfHouses = costOfHouses * -1 * houses[index22]; turnResults.addPlayerCash(player, costOfHouses); }//END FOR return(turnResults); }
//--------------------------------------------------------------------- //--------------------------------------------------------------------- //MOVE----------------------------------------------------------------- //--------------------------------------------------------------------- //--------------------------------------------------------------------- //--------------------------------------------------------------------- //MOVE----------------------------------------------------------------- //--------------------------------------------------------------------- public TurnResults move(int player, int spaces, TurnResults turnResults, int playerCash, Jail jail) { int currentLocation40 = playerBoardLocations[player]; boardPlayerLocations[currentLocation40][player] = false; currentLocation40 = (currentLocation40 + spaces) % 40; //CHECK IF PASSED GO if (turnResults.location > currentLocation40) { System.Windows.Forms.MessageBox.Show("Passed Go!"); turnResults.addPlayerCash(player, 200); }//END IF turnResults.location = currentLocation40; return(processMove(player, spaces, turnResults, playerCash, jail)); }
public TurnResults battle( int[] players, int propertyValue, TurnResults turnResults, DisplayResources displayResources) { int[] order = new int[players.Length]; int cash = 0; int player = 0; int place = 0; Array.Copy(setOrder(order), order, order.Length); for (int index = 0; index < order.Length; index++) { cash = propertyValue * arrayPropertyMultipliers[players.Length - 2][index]; player = players[order[index]]; place = index + 1; turnResults.addPlayerCash(player, cash); System.Windows.Forms.MessageBox.Show( "Battle " + Convert.ToString(index) + " place " + displayResources.getPlayerName(player) + " cash " + Convert.ToString(cash) + " drinks " + arrayDrinkMultipliers[players.Length - 2][index]); }//END FOR return(turnResults); }
//--------------------------------------------------------------------- //MAKE TRADE----------------------------------------------------------- //--------------------------------------------------------------------- public TurnResults makeTrade( int currentPlayer, int tradePlayer, Boolean[] propertiesToPlayer, Boolean[] propertiesToTradePlayer, TurnResults turnResults) { int squareIndex22 = 0; int housesOnSet = 0; int totalHousesCost = 0; for (int index28 = 0; index28 < propertiesToPlayer.Length; index28++) { if (index28 == 0 || index28 == 1 || index28 == 3 || index28 == 4 || index28 == 5 || index28 == 6 || index28 == 8 || index28 == 9 || index28 == 11 || index28 == 12 || index28 == 13 || index28 == 14 || index28 == 15 || index28 == 16 || index28 == 18 || index28 == 19 || index28 == 21 || index28 == 22 || index28 == 23 || index28 == 24 || index28 == 26 || index28 == 27) { // 0 0 Mediterranean Avenue // 1 1 Baltic Avenue // 3 2 Oriental Avenue // 4 3 Vermont Avenue // 5 4 Connecticut Avenue // 6 5 St. Charles Place // 8 6 States Avenue // 9 7 Virginia Avenue // 11 8 St. James Place // 12 9 Tennessee Avenue // 13 10 New York Avenue // 14 11 Kentucky Avenue // 15 12 Indiana Avenue // 16 13 Illinois Avenue // 18 14 Atlantic Avenue // 19 15 Ventnor Avenue // 21 16 Marvin Gardens // 22 17 Pacific Avenue // 23 18 North Carolina Avenue // 24 19 Pennsylvania Avenue // 26 20 Park Place // 27 21 Boardwalk squareIndex22 = indexConversions.get22IndexFrom28Index(index28); housesOnSet = propertyOwners.getHousesOnSet(squareIndex22); if (propertiesToPlayer[index28] && housesOnSet > 0) { totalHousesCost = propertyInfo.getHousePropertyHouseCost(squareIndex22); totalHousesCost = totalHousesCost * housesOnSet; turnResults.addPlayerCash(tradePlayer, totalHousesCost); propertyOwners.removeAllHousesInSet(tradePlayer, squareIndex22); }//END IF if (propertiesToTradePlayer[index28] && housesOnSet > 0) { totalHousesCost = propertyInfo.getHousePropertyHouseCost(squareIndex22); totalHousesCost = totalHousesCost * housesOnSet; turnResults.addPlayerCash(currentPlayer, totalHousesCost); propertyOwners.removeAllHousesInSet(currentPlayer, squareIndex22); } //END IF } //END IF } //END FOR propertyOwners.makeTrade( currentPlayer, tradePlayer, propertiesToPlayer, propertiesToTradePlayer); return(turnResults); }
//--------------------------------------------------------------------- private TurnResults processMove(int player, int spaces, TurnResults turnResults, int playerCash, Jail jail) { int currentLocation40 = turnResults.location; int squareIndex28 = 0; int squareIndex22 = 0; int cashAssets = 0; int rent = 0; int propertyOwner = 0; int railRoads = 0; boardPlayerLocations[currentLocation40][player] = true; playerBoardLocations[player] = currentLocation40; if (currentLocation40 == 0) { // 0 GO processBattle(turnResults, currentLocation40, jail); turnResults.addPlayerCash(player, 200); } else if (currentLocation40 == 10) { // 10 Jail processBattle(turnResults, currentLocation40, jail); System.Windows.Forms.MessageBox.Show("Just Visiting"); } else if (currentLocation40 == 20) { // 20 Free Parking processBattle(turnResults, currentLocation40, jail); System.Windows.Forms.MessageBox.Show("Free Parking!"); turnResults.addPlayerCash(player, turnResults.freeParkingMoney); turnResults.freeParkingMoney = 500; } else if (currentLocation40 == 30) { // 30 Go To Jail System.Windows.Forms.MessageBox.Show("Go to Jail. Go directly to Jail. Do not pass GO, do not collect $200."); turnResults.location = 10; boardPlayerLocations[currentLocation40][player] = false; boardPlayerLocations[turnResults.location][player] = true; playerBoardLocations[player] = turnResults.location; turnResults.inJail = true; } else if (currentLocation40 == 4) { // 4 Income Tax processBattle(turnResults, currentLocation40, jail); cashAssets = playerCash + turnResults.getPlayerCash(player); if (canShowMortgageButton(player) == false && cashAssets < 2000) { cashAssets = cashAssets / 10; System.Windows.Forms.MessageBox.Show("Income Tax: " + cashAssets); cashAssets = cashAssets * -1; turnResults.addPlayerCash(player, cashAssets); } else { System.Windows.Forms.MessageBox.Show("Income Tax: 200"); turnResults.addPlayerCash(player, -200); }//END IF } else if (currentLocation40 == 38) { // 38 Luxury Tax processBattle(turnResults, currentLocation40, jail); System.Windows.Forms.MessageBox.Show("Luxury Tax: 75"); turnResults.addPlayerCash(player, -75); } else if (currentLocation40 == 7 || currentLocation40 == 22 || currentLocation40 == 36) { // 7 Chance 1 // 22 Chance 2 // 36 Chance 3 processBattle(turnResults, currentLocation40, jail); turnResults.setValues(boardProperties.processChanceCard(player, turnResults)); if (currentLocation40 != turnResults.location) { boardPlayerLocations[currentLocation40][player] = false; turnResults.setValues(processMove(player, spaces, turnResults, playerCash, jail)); }//END IF } else if (currentLocation40 == 2 || currentLocation40 == 17 || currentLocation40 == 33) { // 2 Community Chest 1 // 17 Community Chest 2 // 33 Community Chest 3 processBattle(turnResults, currentLocation40, jail); turnResults.setValues(boardProperties.processCommunityChestCard(player, turnResults)); if (currentLocation40 != turnResults.location) { boardPlayerLocations[currentLocation40][player] = false; turnResults.setValues(processMove(player, spaces, turnResults, playerCash, jail)); }//END IF } else if (currentLocation40 == 12 || currentLocation40 == 28) { // 12 Electric Company // 28 Water Works processBattle(turnResults, currentLocation40, jail); squareIndex28 = indexConversions.get28IndexFrom40Index(currentLocation40); propertyOwner = boardProperties.getOwnerOfProperty(squareIndex28); if ((turnResults.rentMultiplier == 10 || boardProperties.getOwnerOfProperty(7) == boardProperties.getOwnerOfProperty(20)) && propertyOwner >= 0 && !boardProperties.propertyMortgaged(squareIndex28)) { rent = spaces * 10; turnResults.addPlayerCash(propertyOwner, rent); rent = rent * -1; turnResults.addPlayerCash(player, rent); } else if (propertyOwner >= 0 && !boardProperties.propertyMortgaged(squareIndex28)) { rent = spaces * 4; turnResults.addPlayerCash(propertyOwner, rent); rent = rent * -1; turnResults.addPlayerCash(player, rent); }//END IF turnResults.rentMultiplier = 1; } else if (currentLocation40 == 5 || currentLocation40 == 15 || currentLocation40 == 25 || currentLocation40 == 35) { // 5 Reading Railroad // 15 Pennsylvania Railroad // 25 B&O Railroad // 35 Short Line processBattle(turnResults, currentLocation40, jail); squareIndex28 = indexConversions.get28IndexFrom40Index(currentLocation40); propertyOwner = boardProperties.getOwnerOfProperty(squareIndex28); railRoads = 0; if (propertyOwner >= 0 && !boardProperties.propertyMortgaged(squareIndex28)) { if (propertyOwner == boardProperties.getOwnerOfProperty(2)) { railRoads++; }//END IF if (propertyOwner == boardProperties.getOwnerOfProperty(10)) { railRoads++; }//END IF if (propertyOwner == boardProperties.getOwnerOfProperty(17)) { railRoads++; }//END IF if (propertyOwner == boardProperties.getOwnerOfProperty(25)) { railRoads++; }//END IF if (railRoads == 1) { rent = 25 * turnResults.rentMultiplier; } else if (railRoads == 2) { rent = 50 * turnResults.rentMultiplier; } else if (railRoads == 3) { rent = 100 * turnResults.rentMultiplier; } else if (railRoads == 4) { rent = 200 * turnResults.rentMultiplier; }//END IF turnResults.addPlayerCash(propertyOwner, rent); rent = rent * -1; turnResults.addPlayerCash(player, rent); }//END IF turnResults.rentMultiplier = 1; } else if (currentLocation40 == 1 || currentLocation40 == 3 || currentLocation40 == 6 || currentLocation40 == 8 || currentLocation40 == 9 || currentLocation40 == 11 || currentLocation40 == 13 || currentLocation40 == 14 || currentLocation40 == 16 || currentLocation40 == 18 || currentLocation40 == 19 || currentLocation40 == 21 || currentLocation40 == 23 || currentLocation40 == 24 || currentLocation40 == 26 || currentLocation40 == 27 || currentLocation40 == 29 || currentLocation40 == 31 || currentLocation40 == 32 || currentLocation40 == 34 || currentLocation40 == 37 || currentLocation40 == 39) { // 1 Mediterranean Avenue // 3 Baltic Avenue // 6 Oriental Avenue // 8 Vermont Avenue // 9 Connecticut Avenue // 11 St. Charles Place // 13 States Avenue // 14 Virginia Avenue // 16 St. James Place // 18 Tennessee Avenue // 19 New York Avenue // 21 Kentucky Avenue // 23 Indiana Avenue // 24 Illinois Avenue // 26 Atlantic Avenue // 27 Ventnor Avenue // 29 Marvin Gardens // 31 Pacific Avenue // 32 North Carolina Avenue // 34 Pennsylvania Avenue // 37 Park Place // 39 Boardwalk processBattle(turnResults, currentLocation40, jail); squareIndex28 = indexConversions.get28IndexFrom40Index(currentLocation40); squareIndex22 = indexConversions.get22IndexFrom40Index(currentLocation40); propertyOwner = boardProperties.getOwnerOfProperty(squareIndex28); if (propertyOwner >= 0 && !boardProperties.propertyMortgaged(squareIndex28)) { rent = boardProperties.getHousePropertyRent( propertyOwner, squareIndex22, boardProperties.getHousesOnProperty(squareIndex22)); turnResults.addPlayerCash(propertyOwner, rent); rent = rent * -1; turnResults.addPlayerCash(player, rent); } //END IF } //END IF return(turnResults); }