public void RemoveCard(Card c) { if (Deck.Contains(c)) Deck.Remove(c); else Game1.debugMessageQueue.addMessageToQueue("Warning: Card " + c + "does not exist! Cannot remove from deck!"); }
List<Card> Deck; // The Deck #endregion Fields #region Constructors public DeckOfCards(Card[] cardArray) { Deck = new List<Card>(); foreach (Card c in cardArray) Deck.Add(c); }
public void AddCard(Card c) { Deck.Add(c); }
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"); } }