public int calcCommerceIncome(Card playedCard, GameState gs, int playerId) { PlayerState thePlayer = gs.getPlayerNum(playerId); //System.Console.WriteLine(playedCard.getNumber()); if (!playedCard.getName().StartsWith("CO")) { return(0); } if (playedCard.GetType() != typeof(CommerceCard)) { return(0); } CommerceCard commCard = (CommerceCard)playedCard; if (commCard.getCoins() != 0) { return(commCard.getCoins()); } if ((commCard.getNumber().Equals(77)) || (commCard.getNumber().Equals(78))) { return(countCardType(1, thePlayer) + countCardType(1, gs.getLeftPlayer(thePlayer)) + countCardType(1, gs.getRightPlayer(thePlayer))); } if ((commCard.getNumber().Equals(80)) || (commCard.getNumber().Equals(79))) { return(countCardType(2, thePlayer) + countCardType(2, gs.getLeftPlayer(thePlayer)) + countCardType(2, gs.getRightPlayer(thePlayer))); } //Haven if ((commCard.getNumber().Equals(119)) || (commCard.getNumber().Equals(120))) { return(countCardType(1, thePlayer)); } //LightHouse if ((commCard.getNumber().Equals(121)) || (commCard.getNumber().Equals(122))) { return(countCardType(4, thePlayer)); } //Chamber of Commerce if ((commCard.getNumber().Equals(123)) || (commCard.getNumber().Equals(124))) { return(2 * countCardType(2, thePlayer)); } //Arena if ((commCard.getNumber().Equals(125)) || (commCard.getNumber().Equals(126)) || (commCard.getNumber().Equals(127))) { return(3 * thePlayer.getBoard().getCurrentWonderLevel()); } return(0); }
public void CheckCommerceCard(PlayerState p, Card c) { if (Log(p)) { Console.WriteLine("\n--------------------------------------------------------------------------------------------------------"); CommerceCard card = (CommerceCard)c; int totalResourceCost = c.getTotalResourceCost(); int[] costs = card.getCost(); int[] collect = card.getCollect(); int[] resourceTradable = card.getResourceTradable(); Console.WriteLine("[{0}] Commerce Card [{1}] Total Resource Cost [{2}]", _class.GetType().Name , c.getName() , totalResourceCost); var resources = Enum.GetValues(typeof(Resource)); // Get the cost and display it Console.WriteLine("[Card.getCost() ] "); foreach (var resource in resources) { int index = (int)resource; Console.Write("[{0} : {1}] ", ((Resource)index).ToString(), costs[index]); } Console.WriteLine(); //0 = none, 1 = resource card, 2 = manufactured good int resourceType = card.getResources(); Console.WriteLine("[Card.getCollect()] RT [{0}] ] ", resourceType); // resources = Enum.GetValues(typeof(Resource)); for (int index = 0; index < collect.Count(); index++) { Console.Write("[{0} : {1}] ", ((Resource)index).ToString(), collect[index]); } Console.WriteLine(); // resources = Enum.GetValues(typeof(Resource)); // Console.WriteLine("[Card.getResourceTradable ({0})] ", card.hasTradableResources()); for (int index = 0; index < resourceTradable.Count(); index++) { Console.Write("[{0} : {1}] ", ((Resource)index).ToString(), resourceTradable[index]); } Console.WriteLine(); Console.WriteLine("--------------------------------------------------------------------------------------------------------\n"); } }
//Missing Code in this Function public void resetCommerceCards(PlayerState p) { List <CommerceCard> tempList = new List <CommerceCard>(); for (int i = 0; i < p.getPlayedCards().Count; i++) { if (p.getPlayedCards()[i].getType() == 4) { CommerceCard c = (CommerceCard)p.getPlayedCards()[i]; if (((c.getNumber() > 30) && (c.getNumber() < 37)) || ((c.getNumber() > 70) && (c.getNumber() < 77))) { tempList.Add(c); } } } ComCards[p.getName()] = tempList; }