示例#1
0
 private void SetDefault()
 {
     // Rules settings fields. Default on standard rules
     Territories = Territory.CreateList();
     IsSeafarers = false;
     UseTradeRoutes = false;
     AssignPortsBeforePlacement = false;
     RequiresInitialShips = false;
     AllowedCards = 7;
     BankResources = 19;
     StockRoads = 15;
     StockShips = 15;
     StockTowns = 5;
     StockCities = 4;
     BonusNewIsland = 1;
     MaxPlayers = 4;
     MinPlayers = 3;
     VpToWin = 10;
     DevCards = new StandardDevCardStack(5, 2, 14, 2, 2);
     BoardType = EBoardCreatedType.Official;
     Creator = "Unknown player";
     Name = String.Format("{0}'s ground", Creator);
     ID = Guid.NewGuid();
 }
        public StandardDevCardStack Copy()
        {
            StandardDevCardStack result = new StandardDevCardStack();

            result.IsExtended = _IsExtended;
            result.IsStandard = _IsStandard;

            result.MonoCount = _MonoCount;
            result.RbCount = _RbCount;
            result.RobberCount = _RobberCount;
            result.VpCount = _VpCount;
            result.YopCount = _YopCount;

            return result;
        }
示例#3
0
        private ObservableCollection<DevelopmentCard> ShuffleDevcardsDeck(StandardDevCardStack standardDevCardStack)
        {
            List<DevelopmentCard> result = new List<DevelopmentCard>();

            // Create a list of all development cards

            // initialize list
            List<DevelopmentCard> allDevs = new List<DevelopmentCard>();

            // Add development cards of each type to the list
            for (int i = 0; i < standardDevCardStack.YopCount; i++)
                allDevs.Add(new YearOfPlenty());
            for (int i = 0; i < standardDevCardStack.RobberCount; i++)
                allDevs.Add(new Soldier());
            for (int i = 0; i < standardDevCardStack.MonoCount; i++)
                allDevs.Add(new Monopoly());
            for (int i = 0; i < standardDevCardStack.VpCount; i++)
                allDevs.Add(new VictoryPoint());
            for (int i = 0; i < standardDevCardStack.RbCount; i++)
                allDevs.Add(new RoadBuilding());

            // Create a list to associate random value to each development card
            List<KeyValuePair<int, DevelopmentCard>> list =
                new List<KeyValuePair<int, DevelopmentCard>>();

            // Associate the random int value to each development card
            foreach (DevelopmentCard dev in allDevs)
                list.Add(new KeyValuePair<int, DevelopmentCard>(_Random.Next(), dev));

            // Sort the list by the random number
            var sorted = from item in list
                         orderby item.Key
                         select item;

            // Copy values to resultlist and add proper ID
            int id = 0;
            foreach (KeyValuePair<int, DevelopmentCard> pair in sorted)
            {
                pair.Value.ID = id;
                result.Add(pair.Value);
                id++;
            }

            return new ObservableCollection<DevelopmentCard>(result);
        }