public static void MovePlayerDiceRoll(Player p, int roll) { int currentPosition = p.CurrentBoardPosition; int newPosition = currentPosition + roll; // If player passes or lands on Go if (newPosition > 47) { newPosition = Math.Abs(newPosition - 48); // Get absolute value of the difference and move player to that new Tile p.BankPaysPlayer(200); // Pay player $200 for passing Go } // Move player to the new position SoshiLandGameFunctions.MovePlayer(p, newPosition); }
public static void FollowCardInstructions(Card card, Player player, List<Player> listOfPlayers) { if (card.getMoneyModifier != 0) // Check if we need to do anything money related { bool negative = false; // Temporary bool to check if the money modifier is negative if (card.getMoneyModifier < 0) negative = true; // Set negative flag switch (card.getPerPlayer) // Check if the card affects all players { case true: // Case when card affects all players switch (negative) // Check if we're removing money { case true: // Case when we're removing money from current player (current player pays all other players) foreach (Player p in listOfPlayers) if (player != p) // Player cannot pay him/herself player.CurrentPlayerPaysPlayer(p, Math.Abs(card.getMoneyModifier)); // Pay each player the amount break; case false: // Case when player pays the bank foreach (Player p in listOfPlayers) if (player != p) // Player cannot be paid by him/herself p.CurrentPlayerPaysPlayer(player, Math.Abs(card.getMoneyModifier)); // Each player pays the current player the amount break; } break; case false: // Case when card does not affect all players switch (negative) // Check if we're removing money { case true: // Case when we're removing money player.PlayerPaysBank(Math.Abs(card.getMoneyModifier)); // Player pays bank break; case false: // Case when we're adding money player.BankPaysPlayer(Math.Abs(card.getMoneyModifier)); // Bank pays player break; } break; } } if (card.getMoveModifier != 0) // Check if we need to do a move modification { // Note: since there are no cards that do this yet, going to skip this for now } if (card.getMovePosition != 0) // Check if we need to do a position movement { if (card.getSpecialCardType == SpecialCardType.CanPassGo) // Check if the card actually moves around the board { if (player.CurrentBoardPosition > card.getMovePosition && player.CurrentBoardPosition <= 47) // Check if the player will pass Go from his or her current location player.BankPaysPlayer(200); // Pay 200 since player will pass Go } MovePlayer(player, card.getMovePosition); } if (card.getSpecialCardType == SpecialCardType.GetOutOfJailFreeCard) { player.FreeJailCards += 1; // Give player a get out of jail free card Game1.debugMessageQueue.addMessageToQueue("Player \"" + player.getName + "\" gets a Get Out of Jail Free Card"); } }
public static void FollowCardInstructions(Card card, Player player, List <Player> listOfPlayers) { if (card.getMoneyModifier != 0) // Check if we need to do anything money related { bool negative = false; // Temporary bool to check if the money modifier is negative if (card.getMoneyModifier < 0) { negative = true; // Set negative flag } switch (card.getPerPlayer) // Check if the card affects all players { case true: // Case when card affects all players switch (negative) // Check if we're removing money { case true: // Case when we're removing money from current player (current player pays all other players) foreach (Player p in listOfPlayers) { if (player != p) // Player cannot pay him/herself { player.CurrentPlayerPaysPlayer(p, Math.Abs(card.getMoneyModifier)); // Pay each player the amount } } break; case false: // Case when player pays the bank foreach (Player p in listOfPlayers) { if (player != p) // Player cannot be paid by him/herself { p.CurrentPlayerPaysPlayer(player, Math.Abs(card.getMoneyModifier)); // Each player pays the current player the amount } } break; } break; case false: // Case when card does not affect all players switch (negative) // Check if we're removing money { case true: // Case when we're removing money player.PlayerPaysBank(Math.Abs(card.getMoneyModifier)); // Player pays bank break; case false: // Case when we're adding money player.BankPaysPlayer(Math.Abs(card.getMoneyModifier)); // Bank pays player break; } break; } } if (card.getMoveModifier != 0) // Check if we need to do a move modification { // Note: since there are no cards that do this yet, going to skip this for now } if (card.getMovePosition != 0) // Check if we need to do a position movement { if (card.getSpecialCardType == SpecialCardType.CanPassGo) // Check if the card actually moves around the board { if (player.CurrentBoardPosition > card.getMovePosition && player.CurrentBoardPosition <= 47) // Check if the player will pass Go from his or her current location { player.BankPaysPlayer(200); // Pay 200 since player will pass Go } } MovePlayer(player, card.getMovePosition); } if (card.getSpecialCardType == SpecialCardType.GetOutOfJailFreeCard) { player.FreeJailCards += 1; // Give player a get out of jail free card Game1.debugMessageQueue.addMessageToQueue("Player \"" + player.getName + "\" gets a Get Out of Jail Free Card"); } }