public static void RollDice(Player p) { SoshilandGame.DoublesRolled = false; int dice1Int = SoshilandGame.die.Next(1, 6); int dice2Int = SoshilandGame.die.Next(1, 6); int total = dice1Int + dice2Int; SoshilandGame.currentDiceRoll = total; // Set the global dice roll variable if (dice1Int == dice2Int && SoshilandGame.gameInitialized) { SoshilandGame.DoublesRolled = true; // Check if it's the third consecutive double roll if (SoshilandGame.numberOfDoubles == 2) { // Move player to jail SoshiLandGameFunctions.MovePlayerToJail(p); } else { // Increment number of doubles SoshilandGame.numberOfDoubles++; } } Game1.debugMessageQueue.addMessageToQueue("Player " + "\"" + p.getName + "\"" + " rolls dice: " + dice1Int + " and " + dice2Int + ". Total: " + total); if (SoshilandGame.DoublesRolled) { Game1.debugMessageQueue.addMessageToQueue("Player " + "\"" + p.getName + "\"" + " rolled doubles!"); } // Only move if the player is not in jail if ((!p.inJail) && SoshilandGame.gameInitialized) { SoshiLandGameFunctions.MovePlayerDiceRoll(p, total); } }
private void PlayerOptions(Player player) { int currentTile = player.CurrentBoardPosition; TileType currentTileType = Tiles[currentTile].getTileType; optionPurchaseOrAuctionProperty = false; optionDevelopProperty = false; // Determine Player Options and take any actions required switch (currentTileType) { case TileType.Property: PropertyTile currentProperty = (PropertyTile)Tiles[currentTile]; if (currentProperty.Owner == null) // If the property is not owned yet { optionPurchaseOrAuctionProperty = true; } else if (currentProperty.Owner != player && !currentProperty.MortgageStatus) // If the property is owned by another player and not mortgaged { if (player.getMoney >= currentProperty.getRent) // Check if the player has enough money to pay Rent { player.CurrentPlayerPaysPlayer(currentProperty.Owner, currentProperty.getRent); // Pay rent turnPhase = 2; // Go to next phase } else { optionPromptMortgageOrTrade = true; // Player must decide to mortgage or trade to get money } } else { // Otherwise, player landed on his or her own property, so go to next phase turnPhase = 2; } break; case TileType.Utility: UtilityTile currentUtility = (UtilityTile)Tiles[currentTile]; UtilityTile otherUtility; if (currentTile == 15) { otherUtility = (UtilityTile)Tiles[33]; } else { otherUtility = (UtilityTile)Tiles[15]; } if (currentUtility.Owner == null) // If the property is not owned yet { optionPurchaseOrAuctionUtility = true; } else if (currentUtility.Owner != player && !currentUtility.MortgageStatus) // If the property is owned by another player { int utilityRent; // Calculate the amount to pay for Utility Rent if (currentUtility.Owner == otherUtility.Owner) // Check if player owns both utilities { utilityRent = (int)currentDiceRoll * 10; } else { utilityRent = (int)currentDiceRoll * 4; } if (player.getMoney >= utilityRent) // Check if the player has enough money to pay Rent { player.CurrentPlayerPaysPlayer(currentUtility.Owner, utilityRent); // Pay rent turnPhase = 2; // Go to next phase } else { optionPromptMortgageOrTrade = true; // Player must decide to mortgage or trade to get money } } else { // Otherwise, player landed on his or her own property, so go to next phase turnPhase = 2; } break; case TileType.Chance: Card drawnChanceCard = ChanceCards.drawCard(); // Draw the Chance card SoshiLandGameFunctions.FollowCardInstructions(drawnChanceCard, player, ListOfPlayers); turnPhase = 2; break; case TileType.CommunityChest: Card drawnCommunityChestCard = CommunityChestCards.drawCard(); // Draw the Community Chest card SoshiLandGameFunctions.FollowCardInstructions(drawnCommunityChestCard, player, ListOfPlayers); turnPhase = 2; break; case TileType.FanMeeting: turnPhase = 2; // Nothing happens, so go to last phase break; case TileType.Jail: turnPhase = 2; // Nothing happens, so go to last phase break; case TileType.ShoppingSpree: currentTurnsPlayers.PlayerPaysBank(75); // Pay Bank taxes turnPhase = 2; break; case TileType.SpecialLuxuryTax: Game1.debugMessageQueue.addMessageToQueue("Player " + "\"" + currentTurnsPlayers.getName + "\"" + " must choose to pay 10% of net worth, or $200"); Game1.debugMessageQueue.addMessageToQueue("Press K to pay 10% of net worth, or L to pay $200"); optionPromptLuxuryTax = true; break; case TileType.GoToJail: SoshiLandGameFunctions.MovePlayerToJail(player); break; case TileType.Go: turnPhase = 2; break; } optionsCalculated = true; if (Game1.DEBUG) { string optionsMessage = "Options Available: Trade,"; if (optionDevelopProperty) { optionsMessage = optionsMessage + " Develop,"; } if (optionPurchaseOrAuctionProperty || optionPurchaseOrAuctionUtility) { optionsMessage = optionsMessage + " Purchase/Auction"; } Game1.debugMessageQueue.addMessageToQueue(optionsMessage); } }