public Deck(int numPlayers) { JObject _json = JObject.Parse(File.ReadAllText("Content/Json/cards.json")); age1 = new List<Card>(); age2 = new List<Card>(); age3 = new List<Card>(); guilds = new List<Card>(); r = 0; // Loops through the cards.json array and gets the cards // one by one and check to see if it meets the number of players // and adds it in, but a special cause is taken into account for // Guild cards, where it will always be inserted into age3 randomly foreach (JObject c in (JArray)_json["cards"]) { // Adding the appropriate cards for the number of players // to the decks by AGE if ((int)c["players"] <= numPlayers) { Card card = new Card(c); switch((int)c["age"]) { case 1: age1.Add(card); break; case 2: age2.Add(card); break; case 3: if ((int)c["players"] == 0) guilds.Add(card); else age3.Add(card); break; } } } addGuilds(numPlayers); }
//Checks whether a player can build a card from a chain public static bool canChainBuild(Player player, Card card) { foreach (string cardID in player.getPlayed()) if (card.chains.Contains(CardLibrary.getCard(cardID).name)) return true; return false; }
public void addPlayed(Card card) { played.Add(card.getImageId()); cardColour[card.colour] += 1; }
// Babylon B [2nd stage] // Handle this at the end of every age to play the last card if // Player can pay for it, or discard to earn 3 coins or build the third wonder. // EXTRA TURN basically private static void LastCard(Player p, Card c) { // stuff }
// Olympia A // the player can, once per Age, build a structure of their choice for free private static void FreeBuild(Player p, Card c, int age) { // stuff p.addPlayed(c); }