Exemple #1
0
        /// <summary>
        /// Pays for and builds the requested rooms.
        /// </summary>
        /// <param name="player"></param>
        /// <param name="rooms"></param>
        /// <param name="resultingNotices"></param>
        public static void BuildRooms(AgricolaPlayer player, int actionId, ImmutableArray <int> rooms, List <GameActionNotice> resultingNotices)
        {
            var costs = Curator.GetRoomsCosts(player, actionId, rooms.Length);

            player.PayCosts(costs);

            foreach (var room in rooms)
            {
                player.AddRoom(room);
            }

            resultingNotices.Add(new GameActionNotice(player.Name, NoticeVerb.Build.ToString(), new BuildPredicate(rooms.Length, Buildable.Room)));
        }
Exemple #2
0
        /// <summary>
        /// Checks that the requested rooms are valid.
        /// </summary>
        /// <param name="player"></param>
        /// <param name="rooms"></param>
        /// <returns></returns>
        public static bool CanBuildRooms(AgricolaPlayer player, int actionId, ImmutableArray <int> rooms)
        {
            var costs = Curator.GetRoomsCosts(player, actionId, rooms.Length);

            return(player.CanAfford(costs) && player.Farmyard.IsValidRoomLocations(rooms));
        }